#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
void dq(int l, int r, vector<int> cand) {
// cerr << l << ' ' << r << ' ' << " cand = ";
// for (int x: cand) cerr << x << ' ';
// cerr << endl;
// assert(r - l + 1 == cand.size());
if (cand.empty()) return;
if (l == r) {
// cerr << "cand.size() = " << cand.size() << endl;
Answer(cand[0], l);
return;
}
int m = l+(r-l)/2;
int cur = -1;
for (int i = l; i <= m; i++)
cur = Query(i);
vector<int> L, R;
for (int x: cand) {
if (Query(x) == cur) {
L.push_back(x);
} else {
R.push_back(x);
}
Query(x);
}
for (int i = l; i <= m; i++)
Query(i);
dq(l, m, L);
dq(m+1, r, R);
}
int f(int n) {
int dep = __lg(n) + 1;
return n * 6 * dep;
}
void Solve(int N) {
vector<int> cand;
int cur = 0;
for (int i = 1; i <= N*2; i++) {
int q = Query(i);
if (q == cur) {
Query(i);
} else {
cand.push_back(i);
}
cur = q;
}
cerr << cand.size() << '\n';
dq(1, N*2, cand);
cerr << f(N) << '\n';
// for (int i = 1; i <= 50; i++) cerr << i << ' ' << f(i) << endl;
/*
for (int i = 1; i <= N*2; i++) {
Query(i);
for (int j = 1; j < i; j++) {
if (Query(j) == 1)
Answer(i, j);
Query(j);
}
Query(i);
}
*/
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
2 ms |
492 KB |
Output is correct |
3 |
Correct |
4 ms |
492 KB |
Output is correct |
4 |
Correct |
10 ms |
748 KB |
Output is correct |
5 |
Correct |
18 ms |
1132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
2 ms |
492 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
10 ms |
748 KB |
Output is correct |
9 |
Correct |
18 ms |
1132 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
12 ms |
1004 KB |
Output is correct |
12 |
Correct |
19 ms |
1260 KB |
Output is correct |
13 |
Correct |
15 ms |
1132 KB |
Output is correct |
14 |
Correct |
15 ms |
1132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
2 ms |
492 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
10 ms |
748 KB |
Output is correct |
9 |
Correct |
18 ms |
1132 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
12 ms |
1004 KB |
Output is correct |
12 |
Correct |
19 ms |
1260 KB |
Output is correct |
13 |
Correct |
15 ms |
1132 KB |
Output is correct |
14 |
Correct |
15 ms |
1132 KB |
Output is correct |
15 |
Incorrect |
24 ms |
2152 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
2 ms |
492 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
10 ms |
748 KB |
Output is correct |
9 |
Correct |
18 ms |
1132 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
12 ms |
1004 KB |
Output is correct |
12 |
Correct |
19 ms |
1260 KB |
Output is correct |
13 |
Correct |
15 ms |
1132 KB |
Output is correct |
14 |
Correct |
15 ms |
1132 KB |
Output is correct |
15 |
Incorrect |
24 ms |
2152 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
2 ms |
492 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
10 ms |
748 KB |
Output is correct |
9 |
Correct |
18 ms |
1132 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
12 ms |
1004 KB |
Output is correct |
12 |
Correct |
19 ms |
1260 KB |
Output is correct |
13 |
Correct |
15 ms |
1132 KB |
Output is correct |
14 |
Correct |
15 ms |
1132 KB |
Output is correct |
15 |
Incorrect |
24 ms |
2152 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
2 ms |
492 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
10 ms |
748 KB |
Output is correct |
9 |
Correct |
18 ms |
1132 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
12 ms |
1004 KB |
Output is correct |
12 |
Correct |
19 ms |
1260 KB |
Output is correct |
13 |
Correct |
15 ms |
1132 KB |
Output is correct |
14 |
Correct |
15 ms |
1132 KB |
Output is correct |
15 |
Incorrect |
24 ms |
2152 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
2 ms |
492 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
10 ms |
748 KB |
Output is correct |
9 |
Correct |
18 ms |
1132 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
12 ms |
1004 KB |
Output is correct |
12 |
Correct |
19 ms |
1260 KB |
Output is correct |
13 |
Correct |
15 ms |
1132 KB |
Output is correct |
14 |
Correct |
15 ms |
1132 KB |
Output is correct |
15 |
Incorrect |
24 ms |
2152 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
2 ms |
492 KB |
Output is correct |
7 |
Correct |
4 ms |
492 KB |
Output is correct |
8 |
Correct |
10 ms |
748 KB |
Output is correct |
9 |
Correct |
18 ms |
1132 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
12 ms |
1004 KB |
Output is correct |
12 |
Correct |
19 ms |
1260 KB |
Output is correct |
13 |
Correct |
15 ms |
1132 KB |
Output is correct |
14 |
Correct |
15 ms |
1132 KB |
Output is correct |
15 |
Incorrect |
24 ms |
2152 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |