#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
int ret;
void solv(vector <int> v1, vector <int> v2, int in1, int in2){
int sz=v2.size();
if(sz==1){
Answer(v1[0], v2[0]);
return;
}
vector <int> v11, v12, v21, v22;
int mid=(sz/2);
for(int i=0;i<mid;i++) ret=Query(v1[i]), v11.push_back(v1[i]);
for(int i=mid;i<sz;i++) v12.push_back(v1[i]);
for(int i=0;i<sz;i++){
int nr=Query(v2[i]);
if(nr==ret){
if(in1==1) v22.push_back(v2[i]);
else v21.push_back(v2[i]);
}
else{
if(in1==1) v21.push_back(v2[i]);
else v22.push_back(v2[i]);
}
ret=nr;
}
solv(v11, v21, 1-in1, 1-in2);
solv(v12, v22, in1, 1-in2);
}
void Solve(int N) {
if(N==1){
Answer(1, 2);
return;
}
ret=0;
vector <int> v1, v2;
for(int i=1;i<=2*N;i++){
int nr=Query(i);
if(nr==ret) v2.push_back(i);
else v1.push_back(i);
ret=nr;
}
solv(v1, v2, 1, 1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
3 ms |
468 KB |
Output is correct |
4 |
Correct |
5 ms |
972 KB |
Output is correct |
5 |
Correct |
10 ms |
1368 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
3 ms |
468 KB |
Output is correct |
8 |
Correct |
5 ms |
972 KB |
Output is correct |
9 |
Correct |
10 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1112 KB |
Output is correct |
12 |
Correct |
12 ms |
1532 KB |
Output is correct |
13 |
Correct |
8 ms |
1368 KB |
Output is correct |
14 |
Correct |
10 ms |
1392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
3 ms |
468 KB |
Output is correct |
8 |
Correct |
5 ms |
972 KB |
Output is correct |
9 |
Correct |
10 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1112 KB |
Output is correct |
12 |
Correct |
12 ms |
1532 KB |
Output is correct |
13 |
Correct |
8 ms |
1368 KB |
Output is correct |
14 |
Correct |
10 ms |
1392 KB |
Output is correct |
15 |
Correct |
38 ms |
3108 KB |
Output is correct |
16 |
Correct |
26 ms |
3160 KB |
Output is correct |
17 |
Correct |
20 ms |
3028 KB |
Output is correct |
18 |
Correct |
22 ms |
2904 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
3 ms |
468 KB |
Output is correct |
8 |
Correct |
5 ms |
972 KB |
Output is correct |
9 |
Correct |
10 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1112 KB |
Output is correct |
12 |
Correct |
12 ms |
1532 KB |
Output is correct |
13 |
Correct |
8 ms |
1368 KB |
Output is correct |
14 |
Correct |
10 ms |
1392 KB |
Output is correct |
15 |
Correct |
38 ms |
3108 KB |
Output is correct |
16 |
Correct |
26 ms |
3160 KB |
Output is correct |
17 |
Correct |
20 ms |
3028 KB |
Output is correct |
18 |
Correct |
22 ms |
2904 KB |
Output is correct |
19 |
Correct |
36 ms |
3340 KB |
Output is correct |
20 |
Correct |
40 ms |
3160 KB |
Output is correct |
21 |
Correct |
36 ms |
3020 KB |
Output is correct |
22 |
Correct |
21 ms |
3160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
3 ms |
468 KB |
Output is correct |
8 |
Correct |
5 ms |
972 KB |
Output is correct |
9 |
Correct |
10 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1112 KB |
Output is correct |
12 |
Correct |
12 ms |
1532 KB |
Output is correct |
13 |
Correct |
8 ms |
1368 KB |
Output is correct |
14 |
Correct |
10 ms |
1392 KB |
Output is correct |
15 |
Correct |
38 ms |
3108 KB |
Output is correct |
16 |
Correct |
26 ms |
3160 KB |
Output is correct |
17 |
Correct |
20 ms |
3028 KB |
Output is correct |
18 |
Correct |
22 ms |
2904 KB |
Output is correct |
19 |
Correct |
36 ms |
3340 KB |
Output is correct |
20 |
Correct |
40 ms |
3160 KB |
Output is correct |
21 |
Correct |
36 ms |
3020 KB |
Output is correct |
22 |
Correct |
21 ms |
3160 KB |
Output is correct |
23 |
Correct |
32 ms |
3416 KB |
Output is correct |
24 |
Correct |
38 ms |
3312 KB |
Output is correct |
25 |
Correct |
42 ms |
3096 KB |
Output is correct |
26 |
Correct |
24 ms |
3160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
3 ms |
468 KB |
Output is correct |
8 |
Correct |
5 ms |
972 KB |
Output is correct |
9 |
Correct |
10 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1112 KB |
Output is correct |
12 |
Correct |
12 ms |
1532 KB |
Output is correct |
13 |
Correct |
8 ms |
1368 KB |
Output is correct |
14 |
Correct |
10 ms |
1392 KB |
Output is correct |
15 |
Correct |
38 ms |
3108 KB |
Output is correct |
16 |
Correct |
26 ms |
3160 KB |
Output is correct |
17 |
Correct |
20 ms |
3028 KB |
Output is correct |
18 |
Correct |
22 ms |
2904 KB |
Output is correct |
19 |
Correct |
36 ms |
3340 KB |
Output is correct |
20 |
Correct |
40 ms |
3160 KB |
Output is correct |
21 |
Correct |
36 ms |
3020 KB |
Output is correct |
22 |
Correct |
21 ms |
3160 KB |
Output is correct |
23 |
Correct |
32 ms |
3416 KB |
Output is correct |
24 |
Correct |
38 ms |
3312 KB |
Output is correct |
25 |
Correct |
42 ms |
3096 KB |
Output is correct |
26 |
Correct |
24 ms |
3160 KB |
Output is correct |
27 |
Incorrect |
36 ms |
3416 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
3 ms |
468 KB |
Output is correct |
8 |
Correct |
5 ms |
972 KB |
Output is correct |
9 |
Correct |
10 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1112 KB |
Output is correct |
12 |
Correct |
12 ms |
1532 KB |
Output is correct |
13 |
Correct |
8 ms |
1368 KB |
Output is correct |
14 |
Correct |
10 ms |
1392 KB |
Output is correct |
15 |
Correct |
38 ms |
3108 KB |
Output is correct |
16 |
Correct |
26 ms |
3160 KB |
Output is correct |
17 |
Correct |
20 ms |
3028 KB |
Output is correct |
18 |
Correct |
22 ms |
2904 KB |
Output is correct |
19 |
Correct |
36 ms |
3340 KB |
Output is correct |
20 |
Correct |
40 ms |
3160 KB |
Output is correct |
21 |
Correct |
36 ms |
3020 KB |
Output is correct |
22 |
Correct |
21 ms |
3160 KB |
Output is correct |
23 |
Correct |
32 ms |
3416 KB |
Output is correct |
24 |
Correct |
38 ms |
3312 KB |
Output is correct |
25 |
Correct |
42 ms |
3096 KB |
Output is correct |
26 |
Correct |
24 ms |
3160 KB |
Output is correct |
27 |
Incorrect |
36 ms |
3416 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
3 ms |
468 KB |
Output is correct |
8 |
Correct |
5 ms |
972 KB |
Output is correct |
9 |
Correct |
10 ms |
1368 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
7 ms |
1112 KB |
Output is correct |
12 |
Correct |
12 ms |
1532 KB |
Output is correct |
13 |
Correct |
8 ms |
1368 KB |
Output is correct |
14 |
Correct |
10 ms |
1392 KB |
Output is correct |
15 |
Correct |
38 ms |
3108 KB |
Output is correct |
16 |
Correct |
26 ms |
3160 KB |
Output is correct |
17 |
Correct |
20 ms |
3028 KB |
Output is correct |
18 |
Correct |
22 ms |
2904 KB |
Output is correct |
19 |
Correct |
36 ms |
3340 KB |
Output is correct |
20 |
Correct |
40 ms |
3160 KB |
Output is correct |
21 |
Correct |
36 ms |
3020 KB |
Output is correct |
22 |
Correct |
21 ms |
3160 KB |
Output is correct |
23 |
Correct |
32 ms |
3416 KB |
Output is correct |
24 |
Correct |
38 ms |
3312 KB |
Output is correct |
25 |
Correct |
42 ms |
3096 KB |
Output is correct |
26 |
Correct |
24 ms |
3160 KB |
Output is correct |
27 |
Incorrect |
36 ms |
3416 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |