#include "minerals.h"
#include<bits/stdc++.h>
using namespace std;
set<int>st;
int query(int k){
if(st.count(k))
st.erase(k);
else st.insert(k);
return Query(k);
}
void solve(vector<int>A,vector<int>B,int dep){
if(A.size()==1) return Answer(A[0],B[0]);
vector<int>A1,A2;
vector<int>B1,B2;
for(auto i:A)
A1.push_back(i),swap(A1,A2);
int prv=0;
for(auto i:A1)
prv=query(i);
for(auto i:B) {
int x=query(i);
if(st.count(A1[0])^(x==prv))
B2.push_back(i);
else B1.push_back(i);
prv=x;
}
solve(A1,B1,dep^1);
solve(A2,B2,dep^1);
}
void Solve(int N) {
vector<int>A,B;
int prv=0;
for(int i=1;i<=2*N;i++)
if(query(i)!=prv)
A.push_back(i),prv++;
else B.push_back(i);
solve(A,B,0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
9 ms |
724 KB |
Output is correct |
3 |
Correct |
13 ms |
856 KB |
Output is correct |
4 |
Correct |
34 ms |
1368 KB |
Output is correct |
5 |
Correct |
65 ms |
2392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
9 ms |
724 KB |
Output is correct |
7 |
Correct |
13 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1368 KB |
Output is correct |
9 |
Correct |
65 ms |
2392 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
44 ms |
2100 KB |
Output is correct |
12 |
Correct |
73 ms |
2856 KB |
Output is correct |
13 |
Correct |
67 ms |
2904 KB |
Output is correct |
14 |
Correct |
63 ms |
2544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
9 ms |
724 KB |
Output is correct |
7 |
Correct |
13 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1368 KB |
Output is correct |
9 |
Correct |
65 ms |
2392 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
44 ms |
2100 KB |
Output is correct |
12 |
Correct |
73 ms |
2856 KB |
Output is correct |
13 |
Correct |
67 ms |
2904 KB |
Output is correct |
14 |
Correct |
63 ms |
2544 KB |
Output is correct |
15 |
Correct |
243 ms |
6604 KB |
Output is correct |
16 |
Correct |
233 ms |
6604 KB |
Output is correct |
17 |
Correct |
206 ms |
6824 KB |
Output is correct |
18 |
Correct |
197 ms |
5952 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
9 ms |
724 KB |
Output is correct |
7 |
Correct |
13 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1368 KB |
Output is correct |
9 |
Correct |
65 ms |
2392 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
44 ms |
2100 KB |
Output is correct |
12 |
Correct |
73 ms |
2856 KB |
Output is correct |
13 |
Correct |
67 ms |
2904 KB |
Output is correct |
14 |
Correct |
63 ms |
2544 KB |
Output is correct |
15 |
Correct |
243 ms |
6604 KB |
Output is correct |
16 |
Correct |
233 ms |
6604 KB |
Output is correct |
17 |
Correct |
206 ms |
6824 KB |
Output is correct |
18 |
Correct |
197 ms |
5952 KB |
Output is correct |
19 |
Correct |
243 ms |
6944 KB |
Output is correct |
20 |
Correct |
236 ms |
6916 KB |
Output is correct |
21 |
Correct |
229 ms |
7028 KB |
Output is correct |
22 |
Correct |
195 ms |
6000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
9 ms |
724 KB |
Output is correct |
7 |
Correct |
13 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1368 KB |
Output is correct |
9 |
Correct |
65 ms |
2392 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
44 ms |
2100 KB |
Output is correct |
12 |
Correct |
73 ms |
2856 KB |
Output is correct |
13 |
Correct |
67 ms |
2904 KB |
Output is correct |
14 |
Correct |
63 ms |
2544 KB |
Output is correct |
15 |
Correct |
243 ms |
6604 KB |
Output is correct |
16 |
Correct |
233 ms |
6604 KB |
Output is correct |
17 |
Correct |
206 ms |
6824 KB |
Output is correct |
18 |
Correct |
197 ms |
5952 KB |
Output is correct |
19 |
Correct |
243 ms |
6944 KB |
Output is correct |
20 |
Correct |
236 ms |
6916 KB |
Output is correct |
21 |
Correct |
229 ms |
7028 KB |
Output is correct |
22 |
Correct |
195 ms |
6000 KB |
Output is correct |
23 |
Correct |
243 ms |
7036 KB |
Output is correct |
24 |
Correct |
240 ms |
7116 KB |
Output is correct |
25 |
Correct |
224 ms |
7088 KB |
Output is correct |
26 |
Correct |
207 ms |
6024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
9 ms |
724 KB |
Output is correct |
7 |
Correct |
13 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1368 KB |
Output is correct |
9 |
Correct |
65 ms |
2392 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
44 ms |
2100 KB |
Output is correct |
12 |
Correct |
73 ms |
2856 KB |
Output is correct |
13 |
Correct |
67 ms |
2904 KB |
Output is correct |
14 |
Correct |
63 ms |
2544 KB |
Output is correct |
15 |
Correct |
243 ms |
6604 KB |
Output is correct |
16 |
Correct |
233 ms |
6604 KB |
Output is correct |
17 |
Correct |
206 ms |
6824 KB |
Output is correct |
18 |
Correct |
197 ms |
5952 KB |
Output is correct |
19 |
Correct |
243 ms |
6944 KB |
Output is correct |
20 |
Correct |
236 ms |
6916 KB |
Output is correct |
21 |
Correct |
229 ms |
7028 KB |
Output is correct |
22 |
Correct |
195 ms |
6000 KB |
Output is correct |
23 |
Correct |
243 ms |
7036 KB |
Output is correct |
24 |
Correct |
240 ms |
7116 KB |
Output is correct |
25 |
Correct |
224 ms |
7088 KB |
Output is correct |
26 |
Correct |
207 ms |
6024 KB |
Output is correct |
27 |
Incorrect |
247 ms |
7264 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
9 ms |
724 KB |
Output is correct |
7 |
Correct |
13 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1368 KB |
Output is correct |
9 |
Correct |
65 ms |
2392 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
44 ms |
2100 KB |
Output is correct |
12 |
Correct |
73 ms |
2856 KB |
Output is correct |
13 |
Correct |
67 ms |
2904 KB |
Output is correct |
14 |
Correct |
63 ms |
2544 KB |
Output is correct |
15 |
Correct |
243 ms |
6604 KB |
Output is correct |
16 |
Correct |
233 ms |
6604 KB |
Output is correct |
17 |
Correct |
206 ms |
6824 KB |
Output is correct |
18 |
Correct |
197 ms |
5952 KB |
Output is correct |
19 |
Correct |
243 ms |
6944 KB |
Output is correct |
20 |
Correct |
236 ms |
6916 KB |
Output is correct |
21 |
Correct |
229 ms |
7028 KB |
Output is correct |
22 |
Correct |
195 ms |
6000 KB |
Output is correct |
23 |
Correct |
243 ms |
7036 KB |
Output is correct |
24 |
Correct |
240 ms |
7116 KB |
Output is correct |
25 |
Correct |
224 ms |
7088 KB |
Output is correct |
26 |
Correct |
207 ms |
6024 KB |
Output is correct |
27 |
Incorrect |
247 ms |
7264 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
9 ms |
724 KB |
Output is correct |
7 |
Correct |
13 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1368 KB |
Output is correct |
9 |
Correct |
65 ms |
2392 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
44 ms |
2100 KB |
Output is correct |
12 |
Correct |
73 ms |
2856 KB |
Output is correct |
13 |
Correct |
67 ms |
2904 KB |
Output is correct |
14 |
Correct |
63 ms |
2544 KB |
Output is correct |
15 |
Correct |
243 ms |
6604 KB |
Output is correct |
16 |
Correct |
233 ms |
6604 KB |
Output is correct |
17 |
Correct |
206 ms |
6824 KB |
Output is correct |
18 |
Correct |
197 ms |
5952 KB |
Output is correct |
19 |
Correct |
243 ms |
6944 KB |
Output is correct |
20 |
Correct |
236 ms |
6916 KB |
Output is correct |
21 |
Correct |
229 ms |
7028 KB |
Output is correct |
22 |
Correct |
195 ms |
6000 KB |
Output is correct |
23 |
Correct |
243 ms |
7036 KB |
Output is correct |
24 |
Correct |
240 ms |
7116 KB |
Output is correct |
25 |
Correct |
224 ms |
7088 KB |
Output is correct |
26 |
Correct |
207 ms |
6024 KB |
Output is correct |
27 |
Incorrect |
247 ms |
7264 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |