#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
int last = 0;
bool ask(int x) {
int nw = Query(x);
bool g = (last != nw);
last = nw;
return g;
}
void solve(vector<int> a, vector<int> b, bool f) {
if (a.size() == 1) {
Answer(a[0], b[0]);
return;
}
int n = a.size();
int mid = (int) max(1.0, n * 0.4);
vector<int> la, lb, ra, rb;
for (int i = 0; i < n; i++) {
if (i < mid) ask(b[i]), lb.push_back(b[i]);
else rb.push_back(b[i]);
}
for (int i : a) {
if (f) {
if (ask(i)) ra.push_back(i);
else la.push_back(i);
} else {
if (ask(i)) la.push_back(i);
else ra.push_back(i);
}
}
solve(la, lb, f ^ 1);
solve(ra, rb, f);
}
void Solve(int N) {
vector<int> a, b;
for (int i = 1; i <= 2 * N; i++) {
if (ask(i)) a.push_back(i);
else b.push_back(i);
}
solve(a, b, 0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
600 KB |
Output is correct |
3 |
Correct |
3 ms |
956 KB |
Output is correct |
4 |
Correct |
6 ms |
856 KB |
Output is correct |
5 |
Correct |
11 ms |
1624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
956 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
11 ms |
1624 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1280 KB |
Output is correct |
12 |
Correct |
11 ms |
1624 KB |
Output is correct |
13 |
Correct |
9 ms |
1544 KB |
Output is correct |
14 |
Correct |
9 ms |
1624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
956 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
11 ms |
1624 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1280 KB |
Output is correct |
12 |
Correct |
11 ms |
1624 KB |
Output is correct |
13 |
Correct |
9 ms |
1544 KB |
Output is correct |
14 |
Correct |
9 ms |
1624 KB |
Output is correct |
15 |
Correct |
31 ms |
3744 KB |
Output is correct |
16 |
Correct |
31 ms |
3524 KB |
Output is correct |
17 |
Correct |
24 ms |
3844 KB |
Output is correct |
18 |
Correct |
23 ms |
3364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
956 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
11 ms |
1624 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1280 KB |
Output is correct |
12 |
Correct |
11 ms |
1624 KB |
Output is correct |
13 |
Correct |
9 ms |
1544 KB |
Output is correct |
14 |
Correct |
9 ms |
1624 KB |
Output is correct |
15 |
Correct |
31 ms |
3744 KB |
Output is correct |
16 |
Correct |
31 ms |
3524 KB |
Output is correct |
17 |
Correct |
24 ms |
3844 KB |
Output is correct |
18 |
Correct |
23 ms |
3364 KB |
Output is correct |
19 |
Correct |
31 ms |
3568 KB |
Output is correct |
20 |
Correct |
37 ms |
3552 KB |
Output is correct |
21 |
Correct |
25 ms |
3884 KB |
Output is correct |
22 |
Correct |
25 ms |
3536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
956 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
11 ms |
1624 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1280 KB |
Output is correct |
12 |
Correct |
11 ms |
1624 KB |
Output is correct |
13 |
Correct |
9 ms |
1544 KB |
Output is correct |
14 |
Correct |
9 ms |
1624 KB |
Output is correct |
15 |
Correct |
31 ms |
3744 KB |
Output is correct |
16 |
Correct |
31 ms |
3524 KB |
Output is correct |
17 |
Correct |
24 ms |
3844 KB |
Output is correct |
18 |
Correct |
23 ms |
3364 KB |
Output is correct |
19 |
Correct |
31 ms |
3568 KB |
Output is correct |
20 |
Correct |
37 ms |
3552 KB |
Output is correct |
21 |
Correct |
25 ms |
3884 KB |
Output is correct |
22 |
Correct |
25 ms |
3536 KB |
Output is correct |
23 |
Correct |
30 ms |
3804 KB |
Output is correct |
24 |
Correct |
38 ms |
3776 KB |
Output is correct |
25 |
Correct |
25 ms |
3584 KB |
Output is correct |
26 |
Correct |
30 ms |
3804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
956 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
11 ms |
1624 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1280 KB |
Output is correct |
12 |
Correct |
11 ms |
1624 KB |
Output is correct |
13 |
Correct |
9 ms |
1544 KB |
Output is correct |
14 |
Correct |
9 ms |
1624 KB |
Output is correct |
15 |
Correct |
31 ms |
3744 KB |
Output is correct |
16 |
Correct |
31 ms |
3524 KB |
Output is correct |
17 |
Correct |
24 ms |
3844 KB |
Output is correct |
18 |
Correct |
23 ms |
3364 KB |
Output is correct |
19 |
Correct |
31 ms |
3568 KB |
Output is correct |
20 |
Correct |
37 ms |
3552 KB |
Output is correct |
21 |
Correct |
25 ms |
3884 KB |
Output is correct |
22 |
Correct |
25 ms |
3536 KB |
Output is correct |
23 |
Correct |
30 ms |
3804 KB |
Output is correct |
24 |
Correct |
38 ms |
3776 KB |
Output is correct |
25 |
Correct |
25 ms |
3584 KB |
Output is correct |
26 |
Correct |
30 ms |
3804 KB |
Output is correct |
27 |
Correct |
34 ms |
3664 KB |
Output is correct |
28 |
Correct |
31 ms |
3724 KB |
Output is correct |
29 |
Correct |
25 ms |
4052 KB |
Output is correct |
30 |
Correct |
25 ms |
3608 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
956 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
11 ms |
1624 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1280 KB |
Output is correct |
12 |
Correct |
11 ms |
1624 KB |
Output is correct |
13 |
Correct |
9 ms |
1544 KB |
Output is correct |
14 |
Correct |
9 ms |
1624 KB |
Output is correct |
15 |
Correct |
31 ms |
3744 KB |
Output is correct |
16 |
Correct |
31 ms |
3524 KB |
Output is correct |
17 |
Correct |
24 ms |
3844 KB |
Output is correct |
18 |
Correct |
23 ms |
3364 KB |
Output is correct |
19 |
Correct |
31 ms |
3568 KB |
Output is correct |
20 |
Correct |
37 ms |
3552 KB |
Output is correct |
21 |
Correct |
25 ms |
3884 KB |
Output is correct |
22 |
Correct |
25 ms |
3536 KB |
Output is correct |
23 |
Correct |
30 ms |
3804 KB |
Output is correct |
24 |
Correct |
38 ms |
3776 KB |
Output is correct |
25 |
Correct |
25 ms |
3584 KB |
Output is correct |
26 |
Correct |
30 ms |
3804 KB |
Output is correct |
27 |
Correct |
34 ms |
3664 KB |
Output is correct |
28 |
Correct |
31 ms |
3724 KB |
Output is correct |
29 |
Correct |
25 ms |
4052 KB |
Output is correct |
30 |
Correct |
25 ms |
3608 KB |
Output is correct |
31 |
Incorrect |
34 ms |
3740 KB |
Wrong Answer [2] |
32 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
600 KB |
Output is correct |
7 |
Correct |
3 ms |
956 KB |
Output is correct |
8 |
Correct |
6 ms |
856 KB |
Output is correct |
9 |
Correct |
11 ms |
1624 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1280 KB |
Output is correct |
12 |
Correct |
11 ms |
1624 KB |
Output is correct |
13 |
Correct |
9 ms |
1544 KB |
Output is correct |
14 |
Correct |
9 ms |
1624 KB |
Output is correct |
15 |
Correct |
31 ms |
3744 KB |
Output is correct |
16 |
Correct |
31 ms |
3524 KB |
Output is correct |
17 |
Correct |
24 ms |
3844 KB |
Output is correct |
18 |
Correct |
23 ms |
3364 KB |
Output is correct |
19 |
Correct |
31 ms |
3568 KB |
Output is correct |
20 |
Correct |
37 ms |
3552 KB |
Output is correct |
21 |
Correct |
25 ms |
3884 KB |
Output is correct |
22 |
Correct |
25 ms |
3536 KB |
Output is correct |
23 |
Correct |
30 ms |
3804 KB |
Output is correct |
24 |
Correct |
38 ms |
3776 KB |
Output is correct |
25 |
Correct |
25 ms |
3584 KB |
Output is correct |
26 |
Correct |
30 ms |
3804 KB |
Output is correct |
27 |
Correct |
34 ms |
3664 KB |
Output is correct |
28 |
Correct |
31 ms |
3724 KB |
Output is correct |
29 |
Correct |
25 ms |
4052 KB |
Output is correct |
30 |
Correct |
25 ms |
3608 KB |
Output is correct |
31 |
Incorrect |
34 ms |
3740 KB |
Wrong Answer [2] |
32 |
Halted |
0 ms |
0 KB |
- |