#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 = max(1, n / 3);
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 |
0 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 |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
464 KB |
Output is correct |
3 |
Correct |
4 ms |
592 KB |
Output is correct |
4 |
Correct |
9 ms |
976 KB |
Output is correct |
5 |
Correct |
19 ms |
1608 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 |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
9 ms |
976 KB |
Output is correct |
9 |
Correct |
19 ms |
1608 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1216 KB |
Output is correct |
12 |
Correct |
16 ms |
1724 KB |
Output is correct |
13 |
Correct |
14 ms |
1744 KB |
Output is correct |
14 |
Correct |
14 ms |
1628 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 |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
9 ms |
976 KB |
Output is correct |
9 |
Correct |
19 ms |
1608 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1216 KB |
Output is correct |
12 |
Correct |
16 ms |
1724 KB |
Output is correct |
13 |
Correct |
14 ms |
1744 KB |
Output is correct |
14 |
Correct |
14 ms |
1628 KB |
Output is correct |
15 |
Correct |
49 ms |
3876 KB |
Output is correct |
16 |
Correct |
39 ms |
3800 KB |
Output is correct |
17 |
Correct |
44 ms |
3872 KB |
Output is correct |
18 |
Correct |
33 ms |
3704 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 |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
9 ms |
976 KB |
Output is correct |
9 |
Correct |
19 ms |
1608 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1216 KB |
Output is correct |
12 |
Correct |
16 ms |
1724 KB |
Output is correct |
13 |
Correct |
14 ms |
1744 KB |
Output is correct |
14 |
Correct |
14 ms |
1628 KB |
Output is correct |
15 |
Correct |
49 ms |
3876 KB |
Output is correct |
16 |
Correct |
39 ms |
3800 KB |
Output is correct |
17 |
Correct |
44 ms |
3872 KB |
Output is correct |
18 |
Correct |
33 ms |
3704 KB |
Output is correct |
19 |
Correct |
44 ms |
3876 KB |
Output is correct |
20 |
Correct |
41 ms |
3984 KB |
Output is correct |
21 |
Correct |
38 ms |
3868 KB |
Output is correct |
22 |
Correct |
33 ms |
3780 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 |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
9 ms |
976 KB |
Output is correct |
9 |
Correct |
19 ms |
1608 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1216 KB |
Output is correct |
12 |
Correct |
16 ms |
1724 KB |
Output is correct |
13 |
Correct |
14 ms |
1744 KB |
Output is correct |
14 |
Correct |
14 ms |
1628 KB |
Output is correct |
15 |
Correct |
49 ms |
3876 KB |
Output is correct |
16 |
Correct |
39 ms |
3800 KB |
Output is correct |
17 |
Correct |
44 ms |
3872 KB |
Output is correct |
18 |
Correct |
33 ms |
3704 KB |
Output is correct |
19 |
Correct |
44 ms |
3876 KB |
Output is correct |
20 |
Correct |
41 ms |
3984 KB |
Output is correct |
21 |
Correct |
38 ms |
3868 KB |
Output is correct |
22 |
Correct |
33 ms |
3780 KB |
Output is correct |
23 |
Correct |
42 ms |
3980 KB |
Output is correct |
24 |
Correct |
44 ms |
3936 KB |
Output is correct |
25 |
Correct |
44 ms |
3896 KB |
Output is correct |
26 |
Correct |
41 ms |
3876 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 |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
9 ms |
976 KB |
Output is correct |
9 |
Correct |
19 ms |
1608 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1216 KB |
Output is correct |
12 |
Correct |
16 ms |
1724 KB |
Output is correct |
13 |
Correct |
14 ms |
1744 KB |
Output is correct |
14 |
Correct |
14 ms |
1628 KB |
Output is correct |
15 |
Correct |
49 ms |
3876 KB |
Output is correct |
16 |
Correct |
39 ms |
3800 KB |
Output is correct |
17 |
Correct |
44 ms |
3872 KB |
Output is correct |
18 |
Correct |
33 ms |
3704 KB |
Output is correct |
19 |
Correct |
44 ms |
3876 KB |
Output is correct |
20 |
Correct |
41 ms |
3984 KB |
Output is correct |
21 |
Correct |
38 ms |
3868 KB |
Output is correct |
22 |
Correct |
33 ms |
3780 KB |
Output is correct |
23 |
Correct |
42 ms |
3980 KB |
Output is correct |
24 |
Correct |
44 ms |
3936 KB |
Output is correct |
25 |
Correct |
44 ms |
3896 KB |
Output is correct |
26 |
Correct |
41 ms |
3876 KB |
Output is correct |
27 |
Correct |
50 ms |
4060 KB |
Output is correct |
28 |
Correct |
46 ms |
4128 KB |
Output is correct |
29 |
Correct |
36 ms |
4048 KB |
Output is correct |
30 |
Correct |
44 ms |
3976 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 |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
9 ms |
976 KB |
Output is correct |
9 |
Correct |
19 ms |
1608 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1216 KB |
Output is correct |
12 |
Correct |
16 ms |
1724 KB |
Output is correct |
13 |
Correct |
14 ms |
1744 KB |
Output is correct |
14 |
Correct |
14 ms |
1628 KB |
Output is correct |
15 |
Correct |
49 ms |
3876 KB |
Output is correct |
16 |
Correct |
39 ms |
3800 KB |
Output is correct |
17 |
Correct |
44 ms |
3872 KB |
Output is correct |
18 |
Correct |
33 ms |
3704 KB |
Output is correct |
19 |
Correct |
44 ms |
3876 KB |
Output is correct |
20 |
Correct |
41 ms |
3984 KB |
Output is correct |
21 |
Correct |
38 ms |
3868 KB |
Output is correct |
22 |
Correct |
33 ms |
3780 KB |
Output is correct |
23 |
Correct |
42 ms |
3980 KB |
Output is correct |
24 |
Correct |
44 ms |
3936 KB |
Output is correct |
25 |
Correct |
44 ms |
3896 KB |
Output is correct |
26 |
Correct |
41 ms |
3876 KB |
Output is correct |
27 |
Correct |
50 ms |
4060 KB |
Output is correct |
28 |
Correct |
46 ms |
4128 KB |
Output is correct |
29 |
Correct |
36 ms |
4048 KB |
Output is correct |
30 |
Correct |
44 ms |
3976 KB |
Output is correct |
31 |
Correct |
56 ms |
4168 KB |
Output is correct |
32 |
Correct |
50 ms |
4096 KB |
Output is correct |
33 |
Correct |
33 ms |
4132 KB |
Output is correct |
34 |
Correct |
36 ms |
4064 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 |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
9 ms |
976 KB |
Output is correct |
9 |
Correct |
19 ms |
1608 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
1216 KB |
Output is correct |
12 |
Correct |
16 ms |
1724 KB |
Output is correct |
13 |
Correct |
14 ms |
1744 KB |
Output is correct |
14 |
Correct |
14 ms |
1628 KB |
Output is correct |
15 |
Correct |
49 ms |
3876 KB |
Output is correct |
16 |
Correct |
39 ms |
3800 KB |
Output is correct |
17 |
Correct |
44 ms |
3872 KB |
Output is correct |
18 |
Correct |
33 ms |
3704 KB |
Output is correct |
19 |
Correct |
44 ms |
3876 KB |
Output is correct |
20 |
Correct |
41 ms |
3984 KB |
Output is correct |
21 |
Correct |
38 ms |
3868 KB |
Output is correct |
22 |
Correct |
33 ms |
3780 KB |
Output is correct |
23 |
Correct |
42 ms |
3980 KB |
Output is correct |
24 |
Correct |
44 ms |
3936 KB |
Output is correct |
25 |
Correct |
44 ms |
3896 KB |
Output is correct |
26 |
Correct |
41 ms |
3876 KB |
Output is correct |
27 |
Correct |
50 ms |
4060 KB |
Output is correct |
28 |
Correct |
46 ms |
4128 KB |
Output is correct |
29 |
Correct |
36 ms |
4048 KB |
Output is correct |
30 |
Correct |
44 ms |
3976 KB |
Output is correct |
31 |
Correct |
56 ms |
4168 KB |
Output is correct |
32 |
Correct |
50 ms |
4096 KB |
Output is correct |
33 |
Correct |
33 ms |
4132 KB |
Output is correct |
34 |
Correct |
36 ms |
4064 KB |
Output is correct |
35 |
Correct |
46 ms |
4232 KB |
Output is correct |
36 |
Correct |
48 ms |
4172 KB |
Output is correct |
37 |
Correct |
42 ms |
4240 KB |
Output is correct |
38 |
Correct |
40 ms |
3984 KB |
Output is correct |