#include<bits/stdc++.h>
//#pragma GCC optimize ("Ofast, no-stack-protector, unroll-loops, fast-math, O3")
using namespace std;
const char el ='\n';
const char sp = ' ';
typedef long long ll;
#define ios {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
#define mp(x, y) make_pair(x, y)
#define popCnt(x) (__builtin_popcountll(x))
#define pb(x) push_back(x);
#define F first
#define S second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l , int r)
{
return uniform_int_distribution<int>(l , r)(rng) ;
}
vector<int> lp,primes;
static void sieveLinear(int N) {
lp = vector<int>(N+1);// lp[i] = least prime divisor of i
primes = vector<int>();
for (int i = 2; i <= N; ++i) {
if (lp[i] == 0) {
primes.push_back(i);
lp[i] = i;
}
int curLP = lp[i];
for (int p : primes)// all primes smaller than or equal my lowest prime divisor
if (p > curLP || p * 1ll * i > N)
break;
else
lp[p * i] = p;
}
}
int main() {
ios;
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int n;
vector<int> arr(n);
cin >> n;
for(int i = 0; i < n; i++){
cin >> arr[i];
}
sieveLinear(1e6);
vector<vector<int>> factorization(n);
vector<int> cnt(1e6 + 1);
for(int x : arr){
cnt[x]++;
}
for(int i = 2; i <= 1e6; i++){
for(int j = 2 * i ; j <= 1e6; j+= i){
cnt[i] += cnt[j];
}
}
for(int i = 0; i < n; i++){
int cur = arr[i];
while(cur > 1){
int curLp = lp[cur];
while(cur % curLp == 0)
cur /= curLp;
factorization[i].push_back(curLp);
}
int all = n;
for(int j = 1 ; j < 1 << factorization[i].size(); j++){
int mul = 1;
for(int k = 0 ; k < factorization[i].size(); k++){
if((1<<k) & j){
mul *= factorization[i][k];
}
}
if(popCnt(j) % 2){
all -= cnt[mul];
}
else all += cnt[mul];
}
if(all > 0){
// answer found;
for(int j = 0; j < n; j++){
if(__gcd(arr[i],arr[j]) == 1){
cout<< i + 1 << sp << j + 1 << el;
return 0;
}
}
}
}
return 0;
}
I2luY2x1ZGU8Yml0c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HBbaV07CiAgICAgICAgZm9yIChpbnQgcCA6IHByaW1lcykvLyBhbGwgcHJpbWVzIHNtYWxsZXIgdGhhbiBvciBlcXVhbCBteSBsb3dlc3QgcHJpbWUgZGl2aXNvcgogICAgICAgICAgICBpZiAocCA+IGN1ckxQIHx8IHAgKiAxbGwgKiBpID4gTikKICAgICAgICAgICAgICAgIGJyZWFrOwogICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICBscFtwICogaV0gPSBwOwogICAgfQp9CmludCBtYWluKCkgewogICAgaW9zOwovLyAgICBmcmVvcGVuKCJpbnB1dC50eHQiLCAiciIsIHN0ZGluKTsKLy8gICAgZnJlb3Blbigib3V0cHV0LnR4dCIsICJ3Iiwgc3Rkb3V0KTsKICAgIGludCBuOwogICAgdmVjdG9yPGludD4gYXJyKG4pOwogICAgY2luID4+IG47CiAgICBmb3IoaW50IGkgPSAwOyBpIDwgbjsgaSsrKXsKICAgICAgICBjaW4gPj4gYXJyW2ldOwogICAgfQogICAgc2lldmVMaW5lYXIoMWU2KTsKICAgIHZlY3Rvcjx2ZWN0b3I8aW50Pj4gZmFjdG9yaXphdGlvbihuKTsKICAgIHZlY3RvcjxpbnQ+IGNudCgxZTYgKyAxKTsKICAgIGZvcihpbnQgeCA6IGFycil7CiAgICAgICAgY250W3hdKys7CiAgICB9CiAgICBmb3IoaW50IGkgPSAyOyBpIDw9IDFlNjsgaSsrKXsKICAgICAgICBmb3IoaW50IGogPSAyICogaSA7IGogPD0gMWU2OyBqKz0gaSl7CiAgICAgICAgICAgIGNudFtpXSArPSBjbnRbal07CiAgICAgICAgfQogICAgfQogICAgZm9yKGludCBpID0gMDsgaSA8IG47IGkrKyl7CiAgICAgICAgaW50IGN1ciA9IGFycltpXTsKICAgICAgICB3aGlsZShjdXIgPiAxKXsKICAgICAgICAgICAgaW50IGN1ckxwID0gbHBbY3VyXTsKICAgICAgICAgICAgd2hpbGUoY3VyICUgY3VyTHAgPT0gMCkKICAgICAgICAgICAgICAgIGN1ciAvPSBjdXJMcDsKICAgICAgICAgICAgZmFjdG9yaXphdGlvbltpXS5wdXNoX2JhY2soY3VyTHApOwogICAgICAgIH0KICAgICAgICBpbnQgYWxsID0gbjsKICAgICAgICBmb3IoaW50IGogPSAxIDsgaiA8IDEgPDwgZmFjdG9yaXphdGlvbltpXS5zaXplKCk7IGorKyl7CiAgICAgICAgICAgIGludCBtdWwgPSAxOwogICAgICAgICAgICBmb3IoaW50IGsgPSAwIDsgayA8IGZhY3Rvcml6YXRpb25baV0uc2l6ZSgpOyBrKyspewogICAgICAgICAgICAgICAgaWYoKDE8PGspICYgail7CiAgICAgICAgICAgICAgICAgICAgbXVsICo9IGZhY3Rvcml6YXRpb25baV1ba107CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaWYocG9wQ250KGopICUgMil7CiAgICAgICAgICAgICAgICBhbGwgLT0gY250W211bF07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZSBhbGwgKz0gY250W211bF07CiAgICAgICAgfQogICAgICAgIGlmKGFsbCA+IDApewogICAgICAgICAgICAvLyBhbnN3ZXIgZm91bmQ7CiAgICAgICAgICAgIGZvcihpbnQgaiA9IDA7IGogPCBuOyBqKyspewogICAgICAgICAgICAgICAgaWYoX19nY2QoYXJyW2ldLGFycltqXSkgPT0gMSl7CiAgICAgICAgICAgICAgICAgICAgY291dDw8IGkgKyAxIDw8IHNwIDw8IGogKyAxIDw8IGVsOwogICAgICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKICAgIHJldHVybiAwOwp9
Main.java:1: error: illegal character: '#'
#include<bits/stdc++.h>
^
Main.java:1: error: class, interface, or enum expected
#include<bits/stdc++.h>
^
Main.java:4: error: class, interface, or enum expected
const char el ='\n';
^
Main.java:5: error: class, interface, or enum expected
const char sp = ' ';
^
Main.java:6: error: class, interface, or enum expected
typedef long long ll;
^
Main.java:7: error: illegal character: '#'
#define ios {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
^
Main.java:7: error: class, interface, or enum expected
#define ios {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
^
Main.java:7: error: class, interface, or enum expected
#define ios {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
^
Main.java:7: error: class, interface, or enum expected
#define ios {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
^
Main.java:7: error: class, interface, or enum expected
#define ios {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
^
Main.java:8: error: illegal character: '#'
#define mp(x, y) make_pair(x, y)
^
Main.java:9: error: illegal character: '#'
#define popCnt(x) (__builtin_popcountll(x))
^
Main.java:10: error: illegal character: '#'
#define pb(x) push_back(x);
^
Main.java:11: error: illegal character: '#'
#define F first
^
Main.java:11: error: class, interface, or enum expected
#define F first
^
Main.java:12: error: illegal character: '#'
#define S second
^
Main.java:14: error: class, interface, or enum expected
int rand(int l , int r)
^
Main.java:17: error: class, interface, or enum expected
}
^
Main.java:19: error: class, interface, or enum expected
static void sieveLinear(int N) {
^
Main.java:21: error: class, interface, or enum expected
primes = vector<int>();
^
Main.java:22: error: class, interface, or enum expected
for (int i = 2; i <= N; ++i) {
^
Main.java:22: error: class, interface, or enum expected
for (int i = 2; i <= N; ++i) {
^
Main.java:22: error: class, interface, or enum expected
for (int i = 2; i <= N; ++i) {
^
Main.java:25: error: class, interface, or enum expected
lp[i] = i;
^
Main.java:26: error: class, interface, or enum expected
}
^
Main.java:28: error: class, interface, or enum expected
for (int p : primes)// all primes smaller than or equal my lowest prime divisor
^
Main.java:31: error: class, interface, or enum expected
else
^
Main.java:33: error: class, interface, or enum expected
}
^
Main.java:39: error: class, interface, or enum expected
int n;
^
Main.java:40: error: class, interface, or enum expected
vector<int> arr(n);
^
Main.java:41: error: class, interface, or enum expected
cin >> n;
^
Main.java:42: error: class, interface, or enum expected
for(int i = 0; i < n; i++){
^
Main.java:42: error: class, interface, or enum expected
for(int i = 0; i < n; i++){
^
Main.java:42: error: class, interface, or enum expected
for(int i = 0; i < n; i++){
^
Main.java:44: error: class, interface, or enum expected
}
^
Main.java:46: error: class, interface, or enum expected
vector<vector<int>> factorization(n);
^
Main.java:47: error: class, interface, or enum expected
vector<int> cnt(1e6 + 1);
^
Main.java:48: error: class, interface, or enum expected
for(int x : arr){
^
Main.java:50: error: class, interface, or enum expected
}
^
Main.java:51: error: class, interface, or enum expected
for(int i = 2; i <= 1e6; i++){
^
Main.java:51: error: class, interface, or enum expected
for(int i = 2; i <= 1e6; i++){
^
Main.java:52: error: class, interface, or enum expected
for(int j = 2 * i ; j <= 1e6; j+= i){
^
Main.java:52: error: class, interface, or enum expected
for(int j = 2 * i ; j <= 1e6; j+= i){
^
Main.java:54: error: class, interface, or enum expected
}
^
Main.java:56: error: class, interface, or enum expected
for(int i = 0; i < n; i++){
^
Main.java:56: error: class, interface, or enum expected
for(int i = 0; i < n; i++){
^
Main.java:58: error: class, interface, or enum expected
while(cur > 1){
^
Main.java:60: error: class, interface, or enum expected
while(cur % curLp == 0)
^
Main.java:62: error: class, interface, or enum expected
factorization[i].push_back(curLp);
^
Main.java:63: error: class, interface, or enum expected
}
^
Main.java:65: error: class, interface, or enum expected
for(int j = 1 ; j < 1 << factorization[i].size(); j++){
^
Main.java:65: error: class, interface, or enum expected
for(int j = 1 ; j < 1 << factorization[i].size(); j++){
^
Main.java:65: error: class, interface, or enum expected
for(int j = 1 ; j < 1 << factorization[i].size(); j++){
^
Main.java:67: error: class, interface, or enum expected
for(int k = 0 ; k < factorization[i].size(); k++){
^
Main.java:67: error: class, interface, or enum expected
for(int k = 0 ; k < factorization[i].size(); k++){
^
Main.java:67: error: class, interface, or enum expected
for(int k = 0 ; k < factorization[i].size(); k++){
^
Main.java:70: error: class, interface, or enum expected
}
^
Main.java:74: error: class, interface, or enum expected
}
^
Main.java:76: error: class, interface, or enum expected
}
^
Main.java:79: error: class, interface, or enum expected
for(int j = 0; j < n; j++){
^
Main.java:79: error: class, interface, or enum expected
for(int j = 0; j < n; j++){
^
Main.java:82: error: class, interface, or enum expected
return 0;
^
Main.java:83: error: class, interface, or enum expected
}
^
Main.java:89: error: class, interface, or enum expected
}
^
64 errors