#include <bits/stdc++.h>
#include "minerals.h"
using namespace std;
vector<int> s1, s2;
void solve(vector<int> v, int l, int r) {
if(l == r) return Answer(v[0], s1[l]);
int m = (l + r) / 2;
for(int i = l; i <= m; ++i) Query(s1[i]);
vector<int> a1, a2;
for(auto x : v)
if(Query(x) != (m-l+1)) a2.emplace_back(x), Query(x);
else a1.emplace_back(x), Query(x);
for(int i = l; i <= m; ++i) Query(s1[i]);
solve(a1, l, m), solve(a2, m+1, r);
}
void Solve(int N) {
int pre = 0;
for(int i = 1; i <= 2*N; ++i) {
int v = Query(i);
if(v != pre) s1.emplace_back(i), pre = v;
else s2.emplace_back(i), Query(i);
}
for(int i = 0; i < N; ++i) Query(s1[i]);
solve(s2, 0, N-1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
612 KB |
Output is correct |
4 |
Correct |
11 ms |
760 KB |
Output is correct |
5 |
Correct |
19 ms |
1144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
612 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
19 ms |
1144 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
14 ms |
1020 KB |
Output is correct |
12 |
Correct |
20 ms |
1192 KB |
Output is correct |
13 |
Correct |
16 ms |
1144 KB |
Output is correct |
14 |
Correct |
17 ms |
1144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
612 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
19 ms |
1144 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
14 ms |
1020 KB |
Output is correct |
12 |
Correct |
20 ms |
1192 KB |
Output is correct |
13 |
Correct |
16 ms |
1144 KB |
Output is correct |
14 |
Correct |
17 ms |
1144 KB |
Output is correct |
15 |
Incorrect |
34 ms |
2676 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
612 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
19 ms |
1144 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
14 ms |
1020 KB |
Output is correct |
12 |
Correct |
20 ms |
1192 KB |
Output is correct |
13 |
Correct |
16 ms |
1144 KB |
Output is correct |
14 |
Correct |
17 ms |
1144 KB |
Output is correct |
15 |
Incorrect |
34 ms |
2676 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
612 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
19 ms |
1144 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
14 ms |
1020 KB |
Output is correct |
12 |
Correct |
20 ms |
1192 KB |
Output is correct |
13 |
Correct |
16 ms |
1144 KB |
Output is correct |
14 |
Correct |
17 ms |
1144 KB |
Output is correct |
15 |
Incorrect |
34 ms |
2676 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
612 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
19 ms |
1144 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
14 ms |
1020 KB |
Output is correct |
12 |
Correct |
20 ms |
1192 KB |
Output is correct |
13 |
Correct |
16 ms |
1144 KB |
Output is correct |
14 |
Correct |
17 ms |
1144 KB |
Output is correct |
15 |
Incorrect |
34 ms |
2676 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
612 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
19 ms |
1144 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
14 ms |
1020 KB |
Output is correct |
12 |
Correct |
20 ms |
1192 KB |
Output is correct |
13 |
Correct |
16 ms |
1144 KB |
Output is correct |
14 |
Correct |
17 ms |
1144 KB |
Output is correct |
15 |
Incorrect |
34 ms |
2676 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
4 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
612 KB |
Output is correct |
8 |
Correct |
11 ms |
760 KB |
Output is correct |
9 |
Correct |
19 ms |
1144 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
14 ms |
1020 KB |
Output is correct |
12 |
Correct |
20 ms |
1192 KB |
Output is correct |
13 |
Correct |
16 ms |
1144 KB |
Output is correct |
14 |
Correct |
17 ms |
1144 KB |
Output is correct |
15 |
Incorrect |
34 ms |
2676 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |