#include <bits/stdc++.h>
#include "minerals.h"
using namespace std;
bool chk[101010];
int s;
int query(int x)
{
if(chk[x]) s --, chk[x] = 0;
else s ++, chk[x] = 1;
return Query(x);
}
void dnc(vector <int> &X, vector <int> &Y)
{
if(X.size() == 1){
Answer(X[0], Y[0]);
if(s) query(X[0]);
return;
}
vector <int> XL, XR, YL, YR;
int n, m, i;
n = X.size(); m = n / 2;
m = X.size() / 2;
for(i=0; i<m; i++){
XL.push_back(X[i]);
if(s < m) query(X[i]);
}
for(; i<n; i++){
XR.push_back(X[i]);
if(s > m) query(X[i]);
}
for(i=0; i<n; i++){
if(query(Y[i]) != s) YL.push_back(Y[i]);
else YR.push_back(Y[i]);
query(Y[i]);
}
dnc(XL, YL); dnc(XR, YR);
}
void Solve(int n)
{
vector <int> X, Y;
int i;
for(i=1; i<=n+n; i++){
if(query(i) == s) X.push_back(i);
else query(i), Y.push_back(i);
}
dnc(X, Y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
640 KB |
Output is correct |
4 |
Correct |
11 ms |
768 KB |
Output is correct |
5 |
Correct |
17 ms |
1144 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
640 KB |
Output is correct |
8 |
Correct |
11 ms |
768 KB |
Output is correct |
9 |
Correct |
17 ms |
1144 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1200 KB |
Output is correct |
13 |
Correct |
14 ms |
1280 KB |
Output is correct |
14 |
Correct |
14 ms |
1152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
640 KB |
Output is correct |
8 |
Correct |
11 ms |
768 KB |
Output is correct |
9 |
Correct |
17 ms |
1144 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1200 KB |
Output is correct |
13 |
Correct |
14 ms |
1280 KB |
Output is correct |
14 |
Correct |
14 ms |
1152 KB |
Output is correct |
15 |
Incorrect |
31 ms |
2668 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
640 KB |
Output is correct |
8 |
Correct |
11 ms |
768 KB |
Output is correct |
9 |
Correct |
17 ms |
1144 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1200 KB |
Output is correct |
13 |
Correct |
14 ms |
1280 KB |
Output is correct |
14 |
Correct |
14 ms |
1152 KB |
Output is correct |
15 |
Incorrect |
31 ms |
2668 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
640 KB |
Output is correct |
8 |
Correct |
11 ms |
768 KB |
Output is correct |
9 |
Correct |
17 ms |
1144 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1200 KB |
Output is correct |
13 |
Correct |
14 ms |
1280 KB |
Output is correct |
14 |
Correct |
14 ms |
1152 KB |
Output is correct |
15 |
Incorrect |
31 ms |
2668 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
640 KB |
Output is correct |
8 |
Correct |
11 ms |
768 KB |
Output is correct |
9 |
Correct |
17 ms |
1144 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1200 KB |
Output is correct |
13 |
Correct |
14 ms |
1280 KB |
Output is correct |
14 |
Correct |
14 ms |
1152 KB |
Output is correct |
15 |
Incorrect |
31 ms |
2668 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
640 KB |
Output is correct |
8 |
Correct |
11 ms |
768 KB |
Output is correct |
9 |
Correct |
17 ms |
1144 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1200 KB |
Output is correct |
13 |
Correct |
14 ms |
1280 KB |
Output is correct |
14 |
Correct |
14 ms |
1152 KB |
Output is correct |
15 |
Incorrect |
31 ms |
2668 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
640 KB |
Output is correct |
8 |
Correct |
11 ms |
768 KB |
Output is correct |
9 |
Correct |
17 ms |
1144 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1200 KB |
Output is correct |
13 |
Correct |
14 ms |
1280 KB |
Output is correct |
14 |
Correct |
14 ms |
1152 KB |
Output is correct |
15 |
Incorrect |
31 ms |
2668 KB |
Wrong Answer [2] |
16 |
Halted |
0 ms |
0 KB |
- |