#include "minerals.h"
#include<bits/stdc++.h>
using namespace std;
void Solve(int N) {
vector<int> A, B, C(N);
for(int lst = 0, i = 1; i <= 2*N; i++) {
int cc = Query(i);
(cc==lst ? B : A).push_back(i);
lst = cc;
}
// for(auto i : A) cout << i << " "; cout << endl;
for(int i = 1; i <= 2*N; i++)
Query(i);
for(int b = 0; b < 16; b++) {
int lst = 0;
for(int i = 0; i < N; i++)
if((i>>b)&1)
lst = Query(A[i]);
for(int i = 0; i < N; i++) {
int qq = Query(B[i]);
C[i] |= (lst == qq)<<b;
Query(B[i]);
}
for(int i = 0; i < N; i++)
if((i>>b)&1)
Query(A[i]);
// for(auto i : C) cout << i << " "; cout << endl;
}
for(int i = 0; i < N; i++)
Answer(A[C[i]], B[i]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
2 ms |
372 KB |
Output is correct |
3 |
Correct |
3 ms |
456 KB |
Output is correct |
4 |
Correct |
6 ms |
704 KB |
Output is correct |
5 |
Correct |
13 ms |
840 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
372 KB |
Output is correct |
7 |
Correct |
3 ms |
456 KB |
Output is correct |
8 |
Correct |
6 ms |
704 KB |
Output is correct |
9 |
Correct |
13 ms |
840 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
8 ms |
712 KB |
Output is correct |
12 |
Correct |
14 ms |
892 KB |
Output is correct |
13 |
Correct |
10 ms |
932 KB |
Output is correct |
14 |
Correct |
10 ms |
840 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
372 KB |
Output is correct |
7 |
Correct |
3 ms |
456 KB |
Output is correct |
8 |
Correct |
6 ms |
704 KB |
Output is correct |
9 |
Correct |
13 ms |
840 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
8 ms |
712 KB |
Output is correct |
12 |
Correct |
14 ms |
892 KB |
Output is correct |
13 |
Correct |
10 ms |
932 KB |
Output is correct |
14 |
Correct |
10 ms |
840 KB |
Output is correct |
15 |
Incorrect |
20 ms |
1816 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
372 KB |
Output is correct |
7 |
Correct |
3 ms |
456 KB |
Output is correct |
8 |
Correct |
6 ms |
704 KB |
Output is correct |
9 |
Correct |
13 ms |
840 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
8 ms |
712 KB |
Output is correct |
12 |
Correct |
14 ms |
892 KB |
Output is correct |
13 |
Correct |
10 ms |
932 KB |
Output is correct |
14 |
Correct |
10 ms |
840 KB |
Output is correct |
15 |
Incorrect |
20 ms |
1816 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
372 KB |
Output is correct |
7 |
Correct |
3 ms |
456 KB |
Output is correct |
8 |
Correct |
6 ms |
704 KB |
Output is correct |
9 |
Correct |
13 ms |
840 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
8 ms |
712 KB |
Output is correct |
12 |
Correct |
14 ms |
892 KB |
Output is correct |
13 |
Correct |
10 ms |
932 KB |
Output is correct |
14 |
Correct |
10 ms |
840 KB |
Output is correct |
15 |
Incorrect |
20 ms |
1816 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
372 KB |
Output is correct |
7 |
Correct |
3 ms |
456 KB |
Output is correct |
8 |
Correct |
6 ms |
704 KB |
Output is correct |
9 |
Correct |
13 ms |
840 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
8 ms |
712 KB |
Output is correct |
12 |
Correct |
14 ms |
892 KB |
Output is correct |
13 |
Correct |
10 ms |
932 KB |
Output is correct |
14 |
Correct |
10 ms |
840 KB |
Output is correct |
15 |
Incorrect |
20 ms |
1816 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
372 KB |
Output is correct |
7 |
Correct |
3 ms |
456 KB |
Output is correct |
8 |
Correct |
6 ms |
704 KB |
Output is correct |
9 |
Correct |
13 ms |
840 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
8 ms |
712 KB |
Output is correct |
12 |
Correct |
14 ms |
892 KB |
Output is correct |
13 |
Correct |
10 ms |
932 KB |
Output is correct |
14 |
Correct |
10 ms |
840 KB |
Output is correct |
15 |
Incorrect |
20 ms |
1816 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
372 KB |
Output is correct |
7 |
Correct |
3 ms |
456 KB |
Output is correct |
8 |
Correct |
6 ms |
704 KB |
Output is correct |
9 |
Correct |
13 ms |
840 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
8 ms |
712 KB |
Output is correct |
12 |
Correct |
14 ms |
892 KB |
Output is correct |
13 |
Correct |
10 ms |
932 KB |
Output is correct |
14 |
Correct |
10 ms |
840 KB |
Output is correct |
15 |
Incorrect |
20 ms |
1816 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |