#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 gen(239);
int last;
bool query(int x) {
int cur = Query(x);
bool res = cur != last;
last = cur;
return res;
}
void solve(vector<int> a, vector<int> b, bool f) {
int n = a.size();
if (n == 1) {
Answer(a[0], b[0]);
return;
}
int m = n / 2;
vector<int> a1, a2, b1, b2;
for (int i = 0; i < m; ++i) {
query(a[i]);
a1.push_back(a[i]);
}
for (int i = m; i < n; ++i) {
a2.push_back(a[i]);
}
for (int i = 0; i < n; ++i) {
if (b1.size() == a1.size()) {
b2.push_back(b[i]);
continue;
}
if (b2.size() == a2.size()) {
b1.push_back(b[i]);
continue;
}
if (query(b[i]) ^ f) {
b2.push_back(b[i]);
} else {
b1.push_back(b[i]);
}
}
solve(a1, b1, !f);
solve(a2, b2, f);
}
void Solve(int N) {
vector<int> a, b;
last = 0;
for (int i = 1; i <= 2 * N; ++i) {
if (query(i)) {
a.push_back(i);
} else {
b.push_back(i);
}
}
solve(a, b, true);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
388 KB |
Output is correct |
2 |
Correct |
2 ms |
336 KB |
Output is correct |
3 |
Correct |
5 ms |
464 KB |
Output is correct |
4 |
Correct |
8 ms |
848 KB |
Output is correct |
5 |
Correct |
17 ms |
1328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
388 KB |
Output is correct |
6 |
Correct |
2 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
8 ms |
848 KB |
Output is correct |
9 |
Correct |
17 ms |
1328 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1092 KB |
Output is correct |
12 |
Correct |
15 ms |
1384 KB |
Output is correct |
13 |
Correct |
11 ms |
1400 KB |
Output is correct |
14 |
Correct |
12 ms |
1232 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
388 KB |
Output is correct |
6 |
Correct |
2 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
8 ms |
848 KB |
Output is correct |
9 |
Correct |
17 ms |
1328 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1092 KB |
Output is correct |
12 |
Correct |
15 ms |
1384 KB |
Output is correct |
13 |
Correct |
11 ms |
1400 KB |
Output is correct |
14 |
Correct |
12 ms |
1232 KB |
Output is correct |
15 |
Correct |
47 ms |
3156 KB |
Output is correct |
16 |
Correct |
54 ms |
3136 KB |
Output is correct |
17 |
Correct |
38 ms |
3012 KB |
Output is correct |
18 |
Correct |
32 ms |
2888 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
388 KB |
Output is correct |
6 |
Correct |
2 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
8 ms |
848 KB |
Output is correct |
9 |
Correct |
17 ms |
1328 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1092 KB |
Output is correct |
12 |
Correct |
15 ms |
1384 KB |
Output is correct |
13 |
Correct |
11 ms |
1400 KB |
Output is correct |
14 |
Correct |
12 ms |
1232 KB |
Output is correct |
15 |
Correct |
47 ms |
3156 KB |
Output is correct |
16 |
Correct |
54 ms |
3136 KB |
Output is correct |
17 |
Correct |
38 ms |
3012 KB |
Output is correct |
18 |
Correct |
32 ms |
2888 KB |
Output is correct |
19 |
Correct |
41 ms |
3288 KB |
Output is correct |
20 |
Correct |
46 ms |
3284 KB |
Output is correct |
21 |
Correct |
36 ms |
3112 KB |
Output is correct |
22 |
Correct |
42 ms |
2940 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
388 KB |
Output is correct |
6 |
Correct |
2 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
8 ms |
848 KB |
Output is correct |
9 |
Correct |
17 ms |
1328 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1092 KB |
Output is correct |
12 |
Correct |
15 ms |
1384 KB |
Output is correct |
13 |
Correct |
11 ms |
1400 KB |
Output is correct |
14 |
Correct |
12 ms |
1232 KB |
Output is correct |
15 |
Correct |
47 ms |
3156 KB |
Output is correct |
16 |
Correct |
54 ms |
3136 KB |
Output is correct |
17 |
Correct |
38 ms |
3012 KB |
Output is correct |
18 |
Correct |
32 ms |
2888 KB |
Output is correct |
19 |
Correct |
41 ms |
3288 KB |
Output is correct |
20 |
Correct |
46 ms |
3284 KB |
Output is correct |
21 |
Correct |
36 ms |
3112 KB |
Output is correct |
22 |
Correct |
42 ms |
2940 KB |
Output is correct |
23 |
Correct |
43 ms |
3352 KB |
Output is correct |
24 |
Correct |
49 ms |
3264 KB |
Output is correct |
25 |
Correct |
37 ms |
3140 KB |
Output is correct |
26 |
Correct |
37 ms |
3012 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
388 KB |
Output is correct |
6 |
Correct |
2 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
8 ms |
848 KB |
Output is correct |
9 |
Correct |
17 ms |
1328 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1092 KB |
Output is correct |
12 |
Correct |
15 ms |
1384 KB |
Output is correct |
13 |
Correct |
11 ms |
1400 KB |
Output is correct |
14 |
Correct |
12 ms |
1232 KB |
Output is correct |
15 |
Correct |
47 ms |
3156 KB |
Output is correct |
16 |
Correct |
54 ms |
3136 KB |
Output is correct |
17 |
Correct |
38 ms |
3012 KB |
Output is correct |
18 |
Correct |
32 ms |
2888 KB |
Output is correct |
19 |
Correct |
41 ms |
3288 KB |
Output is correct |
20 |
Correct |
46 ms |
3284 KB |
Output is correct |
21 |
Correct |
36 ms |
3112 KB |
Output is correct |
22 |
Correct |
42 ms |
2940 KB |
Output is correct |
23 |
Correct |
43 ms |
3352 KB |
Output is correct |
24 |
Correct |
49 ms |
3264 KB |
Output is correct |
25 |
Correct |
37 ms |
3140 KB |
Output is correct |
26 |
Correct |
37 ms |
3012 KB |
Output is correct |
27 |
Correct |
50 ms |
3416 KB |
Output is correct |
28 |
Correct |
47 ms |
3308 KB |
Output is correct |
29 |
Correct |
33 ms |
3268 KB |
Output is correct |
30 |
Correct |
48 ms |
3200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
388 KB |
Output is correct |
6 |
Correct |
2 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
8 ms |
848 KB |
Output is correct |
9 |
Correct |
17 ms |
1328 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1092 KB |
Output is correct |
12 |
Correct |
15 ms |
1384 KB |
Output is correct |
13 |
Correct |
11 ms |
1400 KB |
Output is correct |
14 |
Correct |
12 ms |
1232 KB |
Output is correct |
15 |
Correct |
47 ms |
3156 KB |
Output is correct |
16 |
Correct |
54 ms |
3136 KB |
Output is correct |
17 |
Correct |
38 ms |
3012 KB |
Output is correct |
18 |
Correct |
32 ms |
2888 KB |
Output is correct |
19 |
Correct |
41 ms |
3288 KB |
Output is correct |
20 |
Correct |
46 ms |
3284 KB |
Output is correct |
21 |
Correct |
36 ms |
3112 KB |
Output is correct |
22 |
Correct |
42 ms |
2940 KB |
Output is correct |
23 |
Correct |
43 ms |
3352 KB |
Output is correct |
24 |
Correct |
49 ms |
3264 KB |
Output is correct |
25 |
Correct |
37 ms |
3140 KB |
Output is correct |
26 |
Correct |
37 ms |
3012 KB |
Output is correct |
27 |
Correct |
50 ms |
3416 KB |
Output is correct |
28 |
Correct |
47 ms |
3308 KB |
Output is correct |
29 |
Correct |
33 ms |
3268 KB |
Output is correct |
30 |
Correct |
48 ms |
3200 KB |
Output is correct |
31 |
Correct |
49 ms |
3472 KB |
Output is correct |
32 |
Correct |
46 ms |
3436 KB |
Output is correct |
33 |
Correct |
35 ms |
3388 KB |
Output is correct |
34 |
Correct |
40 ms |
3160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
388 KB |
Output is correct |
6 |
Correct |
2 ms |
336 KB |
Output is correct |
7 |
Correct |
5 ms |
464 KB |
Output is correct |
8 |
Correct |
8 ms |
848 KB |
Output is correct |
9 |
Correct |
17 ms |
1328 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1092 KB |
Output is correct |
12 |
Correct |
15 ms |
1384 KB |
Output is correct |
13 |
Correct |
11 ms |
1400 KB |
Output is correct |
14 |
Correct |
12 ms |
1232 KB |
Output is correct |
15 |
Correct |
47 ms |
3156 KB |
Output is correct |
16 |
Correct |
54 ms |
3136 KB |
Output is correct |
17 |
Correct |
38 ms |
3012 KB |
Output is correct |
18 |
Correct |
32 ms |
2888 KB |
Output is correct |
19 |
Correct |
41 ms |
3288 KB |
Output is correct |
20 |
Correct |
46 ms |
3284 KB |
Output is correct |
21 |
Correct |
36 ms |
3112 KB |
Output is correct |
22 |
Correct |
42 ms |
2940 KB |
Output is correct |
23 |
Correct |
43 ms |
3352 KB |
Output is correct |
24 |
Correct |
49 ms |
3264 KB |
Output is correct |
25 |
Correct |
37 ms |
3140 KB |
Output is correct |
26 |
Correct |
37 ms |
3012 KB |
Output is correct |
27 |
Correct |
50 ms |
3416 KB |
Output is correct |
28 |
Correct |
47 ms |
3308 KB |
Output is correct |
29 |
Correct |
33 ms |
3268 KB |
Output is correct |
30 |
Correct |
48 ms |
3200 KB |
Output is correct |
31 |
Correct |
49 ms |
3472 KB |
Output is correct |
32 |
Correct |
46 ms |
3436 KB |
Output is correct |
33 |
Correct |
35 ms |
3388 KB |
Output is correct |
34 |
Correct |
40 ms |
3160 KB |
Output is correct |
35 |
Incorrect |
48 ms |
3468 KB |
Wrong Answer [2] |
36 |
Halted |
0 ms |
0 KB |
- |