#include "minerals.h"
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define sz(x) ( (int)(x).size() )
using LL = long long;
int n;
vector<int> part[2];
int prv = 0;
bool query(int x) {
int cur = Query(x);
bool ret = (cur != prv);
prv = cur;
return ret;
}
void solve(int Left, int Right, const vector<int> &candidate) {
if (Left == Right) {
Answer(part[0][Left], candidate[0] );
return ;
}
int Mid = (Left + Right) >> 1;
vector<int> nCandidate[2];
for (int i = Mid + 1; i <= Right; ++i) query(part[0][i]);
for (auto i : candidate) nCandidate[query(i)].emplace_back(i);
solve(Left, Mid, nCandidate[0]);
for (int i = Left; i <= Right; ++i) query(part[0][i]);
solve(Mid + 1, Right, nCandidate[1]);
}
void Solve(int N) {
n = N;
for (int i = 1; i <= n << 1; ++i) part[query(i)].emplace_back(i);
solve(0, n - 1, part[1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
7 ms |
376 KB |
Output is correct |
3 |
Correct |
9 ms |
632 KB |
Output is correct |
4 |
Correct |
13 ms |
792 KB |
Output is correct |
5 |
Correct |
20 ms |
964 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
5 |
Correct |
5 ms |
248 KB |
Output is correct |
6 |
Correct |
7 ms |
376 KB |
Output is correct |
7 |
Correct |
9 ms |
632 KB |
Output is correct |
8 |
Correct |
13 ms |
792 KB |
Output is correct |
9 |
Correct |
20 ms |
964 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
17 ms |
760 KB |
Output is correct |
12 |
Correct |
21 ms |
1016 KB |
Output is correct |
13 |
Correct |
19 ms |
1144 KB |
Output is correct |
14 |
Correct |
19 ms |
888 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
5 |
Correct |
5 ms |
248 KB |
Output is correct |
6 |
Correct |
7 ms |
376 KB |
Output is correct |
7 |
Correct |
9 ms |
632 KB |
Output is correct |
8 |
Correct |
13 ms |
792 KB |
Output is correct |
9 |
Correct |
20 ms |
964 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
17 ms |
760 KB |
Output is correct |
12 |
Correct |
21 ms |
1016 KB |
Output is correct |
13 |
Correct |
19 ms |
1144 KB |
Output is correct |
14 |
Correct |
19 ms |
888 KB |
Output is correct |
15 |
Incorrect |
38 ms |
2232 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
5 |
Correct |
5 ms |
248 KB |
Output is correct |
6 |
Correct |
7 ms |
376 KB |
Output is correct |
7 |
Correct |
9 ms |
632 KB |
Output is correct |
8 |
Correct |
13 ms |
792 KB |
Output is correct |
9 |
Correct |
20 ms |
964 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
17 ms |
760 KB |
Output is correct |
12 |
Correct |
21 ms |
1016 KB |
Output is correct |
13 |
Correct |
19 ms |
1144 KB |
Output is correct |
14 |
Correct |
19 ms |
888 KB |
Output is correct |
15 |
Incorrect |
38 ms |
2232 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
5 |
Correct |
5 ms |
248 KB |
Output is correct |
6 |
Correct |
7 ms |
376 KB |
Output is correct |
7 |
Correct |
9 ms |
632 KB |
Output is correct |
8 |
Correct |
13 ms |
792 KB |
Output is correct |
9 |
Correct |
20 ms |
964 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
17 ms |
760 KB |
Output is correct |
12 |
Correct |
21 ms |
1016 KB |
Output is correct |
13 |
Correct |
19 ms |
1144 KB |
Output is correct |
14 |
Correct |
19 ms |
888 KB |
Output is correct |
15 |
Incorrect |
38 ms |
2232 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
5 |
Correct |
5 ms |
248 KB |
Output is correct |
6 |
Correct |
7 ms |
376 KB |
Output is correct |
7 |
Correct |
9 ms |
632 KB |
Output is correct |
8 |
Correct |
13 ms |
792 KB |
Output is correct |
9 |
Correct |
20 ms |
964 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
17 ms |
760 KB |
Output is correct |
12 |
Correct |
21 ms |
1016 KB |
Output is correct |
13 |
Correct |
19 ms |
1144 KB |
Output is correct |
14 |
Correct |
19 ms |
888 KB |
Output is correct |
15 |
Incorrect |
38 ms |
2232 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
5 |
Correct |
5 ms |
248 KB |
Output is correct |
6 |
Correct |
7 ms |
376 KB |
Output is correct |
7 |
Correct |
9 ms |
632 KB |
Output is correct |
8 |
Correct |
13 ms |
792 KB |
Output is correct |
9 |
Correct |
20 ms |
964 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
17 ms |
760 KB |
Output is correct |
12 |
Correct |
21 ms |
1016 KB |
Output is correct |
13 |
Correct |
19 ms |
1144 KB |
Output is correct |
14 |
Correct |
19 ms |
888 KB |
Output is correct |
15 |
Incorrect |
38 ms |
2232 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
5 |
Correct |
5 ms |
248 KB |
Output is correct |
6 |
Correct |
7 ms |
376 KB |
Output is correct |
7 |
Correct |
9 ms |
632 KB |
Output is correct |
8 |
Correct |
13 ms |
792 KB |
Output is correct |
9 |
Correct |
20 ms |
964 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
17 ms |
760 KB |
Output is correct |
12 |
Correct |
21 ms |
1016 KB |
Output is correct |
13 |
Correct |
19 ms |
1144 KB |
Output is correct |
14 |
Correct |
19 ms |
888 KB |
Output is correct |
15 |
Incorrect |
38 ms |
2232 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |