#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 gen(239);
int diff;
int query(int x) {
return diff = Query(x);
}
void solve(vector<int> a, vector<int> b) {
assert(a.size() == b.size());
if (a.size() == 1) {
Answer(a[0], b[0]);
return;
}
int n = a.size();
vector<int> al, ar, bl, br;
for (int i = 0; i < n / 2; ++i) {
query(a[i]);
al.push_back(a[i]);
}
for (int i = n / 2; i < n; ++i) {
ar.push_back(a[i]);
}
for (int i = 0; i < n; ++i) {
int old_diff = diff;
if (query(b[i]) > old_diff) {
bl.push_back(b[i]);
} else {
query(b[i]);
br.push_back(b[i]);
}
}
solve(bl, al);
solve(ar, br);
}
void Solve(int N) {
vector<int> a, b;
for (int i = 1; i <= 2 * N; ++i) {
int old_diff = diff;
if (query(i) > old_diff) {
a.push_back(i);
} else {
query(i);
b.push_back(i);
}
}
solve(a, b);
}
# |
결과 |
실행 시간 |
메모리 |
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 |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
3 ms |
336 KB |
Output is correct |
3 |
Correct |
5 ms |
464 KB |
Output is correct |
4 |
Correct |
9 ms |
848 KB |
Output is correct |
5 |
Correct |
15 ms |
1300 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 |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
3 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
9 ms |
848 KB |
Output is correct |
9 |
Correct |
15 ms |
1300 KB |
Output is correct |
10 |
Correct |
2 ms |
336 KB |
Output is correct |
11 |
Correct |
12 ms |
976 KB |
Output is correct |
12 |
Correct |
17 ms |
1408 KB |
Output is correct |
13 |
Correct |
13 ms |
1360 KB |
Output is correct |
14 |
Correct |
14 ms |
1228 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 |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
3 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
9 ms |
848 KB |
Output is correct |
9 |
Correct |
15 ms |
1300 KB |
Output is correct |
10 |
Correct |
2 ms |
336 KB |
Output is correct |
11 |
Correct |
12 ms |
976 KB |
Output is correct |
12 |
Correct |
17 ms |
1408 KB |
Output is correct |
13 |
Correct |
13 ms |
1360 KB |
Output is correct |
14 |
Correct |
14 ms |
1228 KB |
Output is correct |
15 |
Incorrect |
32 ms |
3156 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 |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
3 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
9 ms |
848 KB |
Output is correct |
9 |
Correct |
15 ms |
1300 KB |
Output is correct |
10 |
Correct |
2 ms |
336 KB |
Output is correct |
11 |
Correct |
12 ms |
976 KB |
Output is correct |
12 |
Correct |
17 ms |
1408 KB |
Output is correct |
13 |
Correct |
13 ms |
1360 KB |
Output is correct |
14 |
Correct |
14 ms |
1228 KB |
Output is correct |
15 |
Incorrect |
32 ms |
3156 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 |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
3 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
9 ms |
848 KB |
Output is correct |
9 |
Correct |
15 ms |
1300 KB |
Output is correct |
10 |
Correct |
2 ms |
336 KB |
Output is correct |
11 |
Correct |
12 ms |
976 KB |
Output is correct |
12 |
Correct |
17 ms |
1408 KB |
Output is correct |
13 |
Correct |
13 ms |
1360 KB |
Output is correct |
14 |
Correct |
14 ms |
1228 KB |
Output is correct |
15 |
Incorrect |
32 ms |
3156 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 |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
3 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
9 ms |
848 KB |
Output is correct |
9 |
Correct |
15 ms |
1300 KB |
Output is correct |
10 |
Correct |
2 ms |
336 KB |
Output is correct |
11 |
Correct |
12 ms |
976 KB |
Output is correct |
12 |
Correct |
17 ms |
1408 KB |
Output is correct |
13 |
Correct |
13 ms |
1360 KB |
Output is correct |
14 |
Correct |
14 ms |
1228 KB |
Output is correct |
15 |
Incorrect |
32 ms |
3156 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 |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
3 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
9 ms |
848 KB |
Output is correct |
9 |
Correct |
15 ms |
1300 KB |
Output is correct |
10 |
Correct |
2 ms |
336 KB |
Output is correct |
11 |
Correct |
12 ms |
976 KB |
Output is correct |
12 |
Correct |
17 ms |
1408 KB |
Output is correct |
13 |
Correct |
13 ms |
1360 KB |
Output is correct |
14 |
Correct |
14 ms |
1228 KB |
Output is correct |
15 |
Incorrect |
32 ms |
3156 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 |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
3 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
9 ms |
848 KB |
Output is correct |
9 |
Correct |
15 ms |
1300 KB |
Output is correct |
10 |
Correct |
2 ms |
336 KB |
Output is correct |
11 |
Correct |
12 ms |
976 KB |
Output is correct |
12 |
Correct |
17 ms |
1408 KB |
Output is correct |
13 |
Correct |
13 ms |
1360 KB |
Output is correct |
14 |
Correct |
14 ms |
1228 KB |
Output is correct |
15 |
Incorrect |
32 ms |
3156 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |