mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2025-02-02 20:20:07 +00:00
parent
00f0e61763
commit
49ddbf3558
55
Luogu/CF1154G/CF1154G.cpp
Normal file
55
Luogu/CF1154G/CF1154G.cpp
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
|
using std::cin;
|
||||||
|
using std::cout;
|
||||||
|
const char endl = '\n';
|
||||||
|
|
||||||
|
const int N = 1e7 + 5;
|
||||||
|
|
||||||
|
int n, pos[N], x, y;
|
||||||
|
long long ans = std::numeric_limits<long long>::max();
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::ios::sync_with_stdio(false);
|
||||||
|
|
||||||
|
cin >> n;
|
||||||
|
|
||||||
|
for (int i = 1, t; i <= n; i++) {
|
||||||
|
cin >> t;
|
||||||
|
|
||||||
|
if (pos[t] && t < ans) {
|
||||||
|
ans = t;
|
||||||
|
x = pos[t];
|
||||||
|
y = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
pos[t] = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i <= 1e7; i++) {
|
||||||
|
int t = 0;
|
||||||
|
|
||||||
|
for (int j = i; j <= 1e7; j += i) {
|
||||||
|
if (!pos[j]) continue;
|
||||||
|
|
||||||
|
if (!t) {
|
||||||
|
t = j;
|
||||||
|
} else {
|
||||||
|
long long lcm = 1ll * t * j / i;
|
||||||
|
|
||||||
|
if (lcm < ans) {
|
||||||
|
ans = lcm;
|
||||||
|
x = pos[t];
|
||||||
|
y = pos[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << std::min(x, y) << ' ' << std::max(x, y) << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user