#include "minerals.h"
#include <vector>
using namespace std;
void Solve(int N) {
vector<int> fst;
vector<int> snd;
int prev = 0;
for (int i = 1; i <= N*2; i++) {
int tmp = Query(i);
if (tmp > prev) fst.push_back(i);
prev = tmp;
}
for (int i = 1; i <= N*2; i++) {
int tmp = Query(i);
if (tmp < prev) snd.push_back(i);
prev = tmp;
}
int baseline = 0;
for (int i = 0; i < N; i++) {
if (i&1) baseline = Query(fst[i]);
}
vector<int> ids(N, 0);
for (int pd = 1; pd < N; pd <<= 1) {
if (pd > 1) {
for (int i = 0; i < N; i++) {
if ((i&pd) ^ ((i<<1)&pd)) baseline = Query(fst[i]);
}
}
for (int i = 0; i < N; i++) {
int tmp = Query(snd[i]);
int bit = (tmp == baseline);
baseline = tmp;
ids[i] += bit * pd;
}
}
for (int i = 0; i < N; i++) {
Answer(fst[ids[i]], snd[i]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
464 KB |
Output is correct |
4 |
Correct |
3 ms |
604 KB |
Output is correct |
5 |
Correct |
5 ms |
848 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
464 KB |
Output is correct |
8 |
Correct |
3 ms |
604 KB |
Output is correct |
9 |
Correct |
5 ms |
848 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
720 KB |
Output is correct |
12 |
Correct |
8 ms |
976 KB |
Output is correct |
13 |
Correct |
4 ms |
848 KB |
Output is correct |
14 |
Correct |
4 ms |
848 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
464 KB |
Output is correct |
8 |
Correct |
3 ms |
604 KB |
Output is correct |
9 |
Correct |
5 ms |
848 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
720 KB |
Output is correct |
12 |
Correct |
8 ms |
976 KB |
Output is correct |
13 |
Correct |
4 ms |
848 KB |
Output is correct |
14 |
Correct |
4 ms |
848 KB |
Output is correct |
15 |
Incorrect |
14 ms |
1744 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
464 KB |
Output is correct |
8 |
Correct |
3 ms |
604 KB |
Output is correct |
9 |
Correct |
5 ms |
848 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
720 KB |
Output is correct |
12 |
Correct |
8 ms |
976 KB |
Output is correct |
13 |
Correct |
4 ms |
848 KB |
Output is correct |
14 |
Correct |
4 ms |
848 KB |
Output is correct |
15 |
Incorrect |
14 ms |
1744 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
464 KB |
Output is correct |
8 |
Correct |
3 ms |
604 KB |
Output is correct |
9 |
Correct |
5 ms |
848 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
720 KB |
Output is correct |
12 |
Correct |
8 ms |
976 KB |
Output is correct |
13 |
Correct |
4 ms |
848 KB |
Output is correct |
14 |
Correct |
4 ms |
848 KB |
Output is correct |
15 |
Incorrect |
14 ms |
1744 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
464 KB |
Output is correct |
8 |
Correct |
3 ms |
604 KB |
Output is correct |
9 |
Correct |
5 ms |
848 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
720 KB |
Output is correct |
12 |
Correct |
8 ms |
976 KB |
Output is correct |
13 |
Correct |
4 ms |
848 KB |
Output is correct |
14 |
Correct |
4 ms |
848 KB |
Output is correct |
15 |
Incorrect |
14 ms |
1744 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
464 KB |
Output is correct |
8 |
Correct |
3 ms |
604 KB |
Output is correct |
9 |
Correct |
5 ms |
848 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
720 KB |
Output is correct |
12 |
Correct |
8 ms |
976 KB |
Output is correct |
13 |
Correct |
4 ms |
848 KB |
Output is correct |
14 |
Correct |
4 ms |
848 KB |
Output is correct |
15 |
Incorrect |
14 ms |
1744 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
464 KB |
Output is correct |
8 |
Correct |
3 ms |
604 KB |
Output is correct |
9 |
Correct |
5 ms |
848 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
720 KB |
Output is correct |
12 |
Correct |
8 ms |
976 KB |
Output is correct |
13 |
Correct |
4 ms |
848 KB |
Output is correct |
14 |
Correct |
4 ms |
848 KB |
Output is correct |
15 |
Incorrect |
14 ms |
1744 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |