#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
int A[43005];
void Solve(int N) {
vector<int> X, Y;
for (int i = 1, v = 0; i <= 2 * N; ++i) {
int t = Query(i);
if (t > v) X.push_back(i);
else Y.push_back(i);
v = t;
}
for (int i = 1; i <= 2 * N; ++i) Query(i);
for (int i = 0; i < 16; ++i) {
int v = 0;
for (int j = 0; j < N; ++j) if ((j >> i) & 1) v = Query(X[j]);
for (int j = 0; j < N; ++j) {
int t = Query(Y[j]);
if (v == t) A[j] |= 1 << i;
v = t;
}
for (int j = 0; j < N; ++j) Query(Y[j]);
for (int j = 0; j < N; ++j) if ((j >> i) & 1) Query(X[j]);
}
for (int i = 0; i < N; ++i) Answer(Y[i], X[A[i]]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
276 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
424 KB |
Output is correct |
4 |
Correct |
10 ms |
632 KB |
Output is correct |
5 |
Correct |
17 ms |
1016 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
276 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
424 KB |
Output is correct |
8 |
Correct |
10 ms |
632 KB |
Output is correct |
9 |
Correct |
17 ms |
1016 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
12 ms |
892 KB |
Output is correct |
12 |
Correct |
43 ms |
1016 KB |
Output is correct |
13 |
Correct |
13 ms |
1164 KB |
Output is correct |
14 |
Correct |
13 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
276 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
424 KB |
Output is correct |
8 |
Correct |
10 ms |
632 KB |
Output is correct |
9 |
Correct |
17 ms |
1016 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
12 ms |
892 KB |
Output is correct |
12 |
Correct |
43 ms |
1016 KB |
Output is correct |
13 |
Correct |
13 ms |
1164 KB |
Output is correct |
14 |
Correct |
13 ms |
888 KB |
Output is correct |
15 |
Incorrect |
33 ms |
1696 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
276 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
424 KB |
Output is correct |
8 |
Correct |
10 ms |
632 KB |
Output is correct |
9 |
Correct |
17 ms |
1016 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
12 ms |
892 KB |
Output is correct |
12 |
Correct |
43 ms |
1016 KB |
Output is correct |
13 |
Correct |
13 ms |
1164 KB |
Output is correct |
14 |
Correct |
13 ms |
888 KB |
Output is correct |
15 |
Incorrect |
33 ms |
1696 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
276 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
424 KB |
Output is correct |
8 |
Correct |
10 ms |
632 KB |
Output is correct |
9 |
Correct |
17 ms |
1016 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
12 ms |
892 KB |
Output is correct |
12 |
Correct |
43 ms |
1016 KB |
Output is correct |
13 |
Correct |
13 ms |
1164 KB |
Output is correct |
14 |
Correct |
13 ms |
888 KB |
Output is correct |
15 |
Incorrect |
33 ms |
1696 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
276 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
424 KB |
Output is correct |
8 |
Correct |
10 ms |
632 KB |
Output is correct |
9 |
Correct |
17 ms |
1016 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
12 ms |
892 KB |
Output is correct |
12 |
Correct |
43 ms |
1016 KB |
Output is correct |
13 |
Correct |
13 ms |
1164 KB |
Output is correct |
14 |
Correct |
13 ms |
888 KB |
Output is correct |
15 |
Incorrect |
33 ms |
1696 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
276 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
424 KB |
Output is correct |
8 |
Correct |
10 ms |
632 KB |
Output is correct |
9 |
Correct |
17 ms |
1016 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
12 ms |
892 KB |
Output is correct |
12 |
Correct |
43 ms |
1016 KB |
Output is correct |
13 |
Correct |
13 ms |
1164 KB |
Output is correct |
14 |
Correct |
13 ms |
888 KB |
Output is correct |
15 |
Incorrect |
33 ms |
1696 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
276 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
424 KB |
Output is correct |
8 |
Correct |
10 ms |
632 KB |
Output is correct |
9 |
Correct |
17 ms |
1016 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
12 ms |
892 KB |
Output is correct |
12 |
Correct |
43 ms |
1016 KB |
Output is correct |
13 |
Correct |
13 ms |
1164 KB |
Output is correct |
14 |
Correct |
13 ms |
888 KB |
Output is correct |
15 |
Incorrect |
33 ms |
1696 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |