#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void Solve(int N) {
vector<int> A, B, ans(N);
int cur = 0;
for (int i=1;i<=N*2;i++){
int tmp = Query(i);
if (tmp>cur) A.push_back(i);
else B.push_back(i);
cur = tmp;
}
for (int i=0;i<N;i++) if (!(i&1)){
cur = Query(B[i]);
}
//printf("YES\n");
for (int j=0;j<16;j++){
for (int i=(1<<j)-1;i<N;i++){
int tmp = Query(A[i]);
if (tmp==cur) ans[i] |= 1<<j;
cur = tmp;
}
if (j==15) break;
for (int i=0;i<N;i++) if (((i>>j)&1) ^ ((i>>(j+1))&1)){
cur = Query(B[i]);
}
}
//for (int i=0;i<N;i++) printf("%d ", ans[i]);
for (int i=0;i<N;i++) Answer(A[i], B[ans[i]]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
328 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |