#include <bits/stdc++.h>
#include "minerals.h"
using namespace std;
bool chk[101010];
int pv, nx;
int query(int x)
{
nx = Query(x);
if(pv != nx){
pv = nx;
return 1;
}
return 0;
}
void dnc(vector <int> &X, vector <int> &Y, bool f)
{
if(X.size() == 1){
Answer(X[0], Y[0]);
return;
}
vector <int> XL, XR, YL, YR;
int n, m, i;
n = X.size();
if(n & 1){
if(f) m = (n + 1) / 2;
else m = n / 2;
}
else m = n / 2;
for(i=0; i<m; i++){
XL.push_back(X[i]);
if(!f) query(X[i]);
}
for(; i<n; i++){
XR.push_back(X[i]);
if(f) query(X[i]);
}
for(i=0; i<n; i++){
if(query(Y[i])) YR.push_back(Y[i]);
else YL.push_back(Y[i]);
if(YL.size() == XL.size()) break;
if(YR.size() == XR.size()) break;
}
if(YL.size() == XL.size()){
for(i++; i<n; i++) YR.push_back(Y[i]);
}
else{
for(i++; i<n; i++) YL.push_back(Y[i]);
}
dnc(XL, YL, 1); dnc(XR, YR, 0);
}
void Solve(int n)
{
vector <int> X, Y;
int i;
for(i=1; i<=n+n; i++){
if(query(i)) X.push_back(i);
else Y.push_back(i);
}
dnc(X, Y, 1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
512 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
12 ms |
816 KB |
Output is correct |
5 |
Correct |
16 ms |
1024 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
256 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
12 ms |
816 KB |
Output is correct |
9 |
Correct |
16 ms |
1024 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1196 KB |
Output is correct |
13 |
Correct |
12 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
256 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
12 ms |
816 KB |
Output is correct |
9 |
Correct |
16 ms |
1024 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1196 KB |
Output is correct |
13 |
Correct |
12 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1152 KB |
Output is correct |
15 |
Correct |
45 ms |
2592 KB |
Output is correct |
16 |
Correct |
44 ms |
2728 KB |
Output is correct |
17 |
Correct |
31 ms |
2488 KB |
Output is correct |
18 |
Correct |
31 ms |
2456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
256 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
12 ms |
816 KB |
Output is correct |
9 |
Correct |
16 ms |
1024 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1196 KB |
Output is correct |
13 |
Correct |
12 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1152 KB |
Output is correct |
15 |
Correct |
45 ms |
2592 KB |
Output is correct |
16 |
Correct |
44 ms |
2728 KB |
Output is correct |
17 |
Correct |
31 ms |
2488 KB |
Output is correct |
18 |
Correct |
31 ms |
2456 KB |
Output is correct |
19 |
Correct |
43 ms |
2656 KB |
Output is correct |
20 |
Correct |
45 ms |
2668 KB |
Output is correct |
21 |
Correct |
32 ms |
2596 KB |
Output is correct |
22 |
Correct |
33 ms |
2360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
256 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
12 ms |
816 KB |
Output is correct |
9 |
Correct |
16 ms |
1024 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1196 KB |
Output is correct |
13 |
Correct |
12 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1152 KB |
Output is correct |
15 |
Correct |
45 ms |
2592 KB |
Output is correct |
16 |
Correct |
44 ms |
2728 KB |
Output is correct |
17 |
Correct |
31 ms |
2488 KB |
Output is correct |
18 |
Correct |
31 ms |
2456 KB |
Output is correct |
19 |
Correct |
43 ms |
2656 KB |
Output is correct |
20 |
Correct |
45 ms |
2668 KB |
Output is correct |
21 |
Correct |
32 ms |
2596 KB |
Output is correct |
22 |
Correct |
33 ms |
2360 KB |
Output is correct |
23 |
Correct |
46 ms |
2704 KB |
Output is correct |
24 |
Correct |
44 ms |
2688 KB |
Output is correct |
25 |
Correct |
34 ms |
2660 KB |
Output is correct |
26 |
Correct |
34 ms |
2572 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
256 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
12 ms |
816 KB |
Output is correct |
9 |
Correct |
16 ms |
1024 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1196 KB |
Output is correct |
13 |
Correct |
12 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1152 KB |
Output is correct |
15 |
Correct |
45 ms |
2592 KB |
Output is correct |
16 |
Correct |
44 ms |
2728 KB |
Output is correct |
17 |
Correct |
31 ms |
2488 KB |
Output is correct |
18 |
Correct |
31 ms |
2456 KB |
Output is correct |
19 |
Correct |
43 ms |
2656 KB |
Output is correct |
20 |
Correct |
45 ms |
2668 KB |
Output is correct |
21 |
Correct |
32 ms |
2596 KB |
Output is correct |
22 |
Correct |
33 ms |
2360 KB |
Output is correct |
23 |
Correct |
46 ms |
2704 KB |
Output is correct |
24 |
Correct |
44 ms |
2688 KB |
Output is correct |
25 |
Correct |
34 ms |
2660 KB |
Output is correct |
26 |
Correct |
34 ms |
2572 KB |
Output is correct |
27 |
Correct |
48 ms |
2824 KB |
Output is correct |
28 |
Correct |
48 ms |
2744 KB |
Output is correct |
29 |
Correct |
35 ms |
2672 KB |
Output is correct |
30 |
Correct |
34 ms |
2476 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
256 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
12 ms |
816 KB |
Output is correct |
9 |
Correct |
16 ms |
1024 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1196 KB |
Output is correct |
13 |
Correct |
12 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1152 KB |
Output is correct |
15 |
Correct |
45 ms |
2592 KB |
Output is correct |
16 |
Correct |
44 ms |
2728 KB |
Output is correct |
17 |
Correct |
31 ms |
2488 KB |
Output is correct |
18 |
Correct |
31 ms |
2456 KB |
Output is correct |
19 |
Correct |
43 ms |
2656 KB |
Output is correct |
20 |
Correct |
45 ms |
2668 KB |
Output is correct |
21 |
Correct |
32 ms |
2596 KB |
Output is correct |
22 |
Correct |
33 ms |
2360 KB |
Output is correct |
23 |
Correct |
46 ms |
2704 KB |
Output is correct |
24 |
Correct |
44 ms |
2688 KB |
Output is correct |
25 |
Correct |
34 ms |
2660 KB |
Output is correct |
26 |
Correct |
34 ms |
2572 KB |
Output is correct |
27 |
Correct |
48 ms |
2824 KB |
Output is correct |
28 |
Correct |
48 ms |
2744 KB |
Output is correct |
29 |
Correct |
35 ms |
2672 KB |
Output is correct |
30 |
Correct |
34 ms |
2476 KB |
Output is correct |
31 |
Correct |
47 ms |
2784 KB |
Output is correct |
32 |
Correct |
47 ms |
2788 KB |
Output is correct |
33 |
Correct |
33 ms |
2700 KB |
Output is correct |
34 |
Correct |
36 ms |
2512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
256 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
12 ms |
816 KB |
Output is correct |
9 |
Correct |
16 ms |
1024 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
13 ms |
896 KB |
Output is correct |
12 |
Correct |
17 ms |
1196 KB |
Output is correct |
13 |
Correct |
12 ms |
1152 KB |
Output is correct |
14 |
Correct |
13 ms |
1152 KB |
Output is correct |
15 |
Correct |
45 ms |
2592 KB |
Output is correct |
16 |
Correct |
44 ms |
2728 KB |
Output is correct |
17 |
Correct |
31 ms |
2488 KB |
Output is correct |
18 |
Correct |
31 ms |
2456 KB |
Output is correct |
19 |
Correct |
43 ms |
2656 KB |
Output is correct |
20 |
Correct |
45 ms |
2668 KB |
Output is correct |
21 |
Correct |
32 ms |
2596 KB |
Output is correct |
22 |
Correct |
33 ms |
2360 KB |
Output is correct |
23 |
Correct |
46 ms |
2704 KB |
Output is correct |
24 |
Correct |
44 ms |
2688 KB |
Output is correct |
25 |
Correct |
34 ms |
2660 KB |
Output is correct |
26 |
Correct |
34 ms |
2572 KB |
Output is correct |
27 |
Correct |
48 ms |
2824 KB |
Output is correct |
28 |
Correct |
48 ms |
2744 KB |
Output is correct |
29 |
Correct |
35 ms |
2672 KB |
Output is correct |
30 |
Correct |
34 ms |
2476 KB |
Output is correct |
31 |
Correct |
47 ms |
2784 KB |
Output is correct |
32 |
Correct |
47 ms |
2788 KB |
Output is correct |
33 |
Correct |
33 ms |
2700 KB |
Output is correct |
34 |
Correct |
36 ms |
2512 KB |
Output is correct |
35 |
Incorrect |
49 ms |
2992 KB |
Wrong Answer [2] |
36 |
Halted |
0 ms |
0 KB |
- |