#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);
}
mt19937 rng(random_device{}());
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);
shuffle(B.begin(),B.end(),rng);
for(auto i:B) {
if(A1.size()==B1.size()){
B2.push_back(i);
continue;
} else if(A2.size()==B2.size()){
B1.push_back(i);
continue;
}
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 |
1 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 |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
600 KB |
Output is correct |
3 |
Correct |
14 ms |
856 KB |
Output is correct |
4 |
Correct |
34 ms |
1624 KB |
Output is correct |
5 |
Correct |
76 ms |
2488 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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
6 ms |
600 KB |
Output is correct |
7 |
Correct |
14 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1624 KB |
Output is correct |
9 |
Correct |
76 ms |
2488 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
48 ms |
2116 KB |
Output is correct |
12 |
Correct |
82 ms |
2648 KB |
Output is correct |
13 |
Correct |
74 ms |
2904 KB |
Output is correct |
14 |
Correct |
75 ms |
2580 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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
6 ms |
600 KB |
Output is correct |
7 |
Correct |
14 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1624 KB |
Output is correct |
9 |
Correct |
76 ms |
2488 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
48 ms |
2116 KB |
Output is correct |
12 |
Correct |
82 ms |
2648 KB |
Output is correct |
13 |
Correct |
74 ms |
2904 KB |
Output is correct |
14 |
Correct |
75 ms |
2580 KB |
Output is correct |
15 |
Correct |
266 ms |
6636 KB |
Output is correct |
16 |
Correct |
262 ms |
6600 KB |
Output is correct |
17 |
Correct |
242 ms |
6960 KB |
Output is correct |
18 |
Correct |
249 ms |
6088 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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
6 ms |
600 KB |
Output is correct |
7 |
Correct |
14 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1624 KB |
Output is correct |
9 |
Correct |
76 ms |
2488 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
48 ms |
2116 KB |
Output is correct |
12 |
Correct |
82 ms |
2648 KB |
Output is correct |
13 |
Correct |
74 ms |
2904 KB |
Output is correct |
14 |
Correct |
75 ms |
2580 KB |
Output is correct |
15 |
Correct |
266 ms |
6636 KB |
Output is correct |
16 |
Correct |
262 ms |
6600 KB |
Output is correct |
17 |
Correct |
242 ms |
6960 KB |
Output is correct |
18 |
Correct |
249 ms |
6088 KB |
Output is correct |
19 |
Correct |
268 ms |
6908 KB |
Output is correct |
20 |
Correct |
277 ms |
6860 KB |
Output is correct |
21 |
Correct |
246 ms |
7024 KB |
Output is correct |
22 |
Correct |
264 ms |
6348 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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
6 ms |
600 KB |
Output is correct |
7 |
Correct |
14 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1624 KB |
Output is correct |
9 |
Correct |
76 ms |
2488 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
48 ms |
2116 KB |
Output is correct |
12 |
Correct |
82 ms |
2648 KB |
Output is correct |
13 |
Correct |
74 ms |
2904 KB |
Output is correct |
14 |
Correct |
75 ms |
2580 KB |
Output is correct |
15 |
Correct |
266 ms |
6636 KB |
Output is correct |
16 |
Correct |
262 ms |
6600 KB |
Output is correct |
17 |
Correct |
242 ms |
6960 KB |
Output is correct |
18 |
Correct |
249 ms |
6088 KB |
Output is correct |
19 |
Correct |
268 ms |
6908 KB |
Output is correct |
20 |
Correct |
277 ms |
6860 KB |
Output is correct |
21 |
Correct |
246 ms |
7024 KB |
Output is correct |
22 |
Correct |
264 ms |
6348 KB |
Output is correct |
23 |
Correct |
279 ms |
7020 KB |
Output is correct |
24 |
Correct |
288 ms |
7116 KB |
Output is correct |
25 |
Correct |
262 ms |
7184 KB |
Output is correct |
26 |
Correct |
280 ms |
6300 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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
6 ms |
600 KB |
Output is correct |
7 |
Correct |
14 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1624 KB |
Output is correct |
9 |
Correct |
76 ms |
2488 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
48 ms |
2116 KB |
Output is correct |
12 |
Correct |
82 ms |
2648 KB |
Output is correct |
13 |
Correct |
74 ms |
2904 KB |
Output is correct |
14 |
Correct |
75 ms |
2580 KB |
Output is correct |
15 |
Correct |
266 ms |
6636 KB |
Output is correct |
16 |
Correct |
262 ms |
6600 KB |
Output is correct |
17 |
Correct |
242 ms |
6960 KB |
Output is correct |
18 |
Correct |
249 ms |
6088 KB |
Output is correct |
19 |
Correct |
268 ms |
6908 KB |
Output is correct |
20 |
Correct |
277 ms |
6860 KB |
Output is correct |
21 |
Correct |
246 ms |
7024 KB |
Output is correct |
22 |
Correct |
264 ms |
6348 KB |
Output is correct |
23 |
Correct |
279 ms |
7020 KB |
Output is correct |
24 |
Correct |
288 ms |
7116 KB |
Output is correct |
25 |
Correct |
262 ms |
7184 KB |
Output is correct |
26 |
Correct |
280 ms |
6300 KB |
Output is correct |
27 |
Correct |
292 ms |
7232 KB |
Output is correct |
28 |
Correct |
294 ms |
7112 KB |
Output is correct |
29 |
Correct |
263 ms |
7240 KB |
Output is correct |
30 |
Correct |
279 ms |
6628 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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
6 ms |
600 KB |
Output is correct |
7 |
Correct |
14 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1624 KB |
Output is correct |
9 |
Correct |
76 ms |
2488 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
48 ms |
2116 KB |
Output is correct |
12 |
Correct |
82 ms |
2648 KB |
Output is correct |
13 |
Correct |
74 ms |
2904 KB |
Output is correct |
14 |
Correct |
75 ms |
2580 KB |
Output is correct |
15 |
Correct |
266 ms |
6636 KB |
Output is correct |
16 |
Correct |
262 ms |
6600 KB |
Output is correct |
17 |
Correct |
242 ms |
6960 KB |
Output is correct |
18 |
Correct |
249 ms |
6088 KB |
Output is correct |
19 |
Correct |
268 ms |
6908 KB |
Output is correct |
20 |
Correct |
277 ms |
6860 KB |
Output is correct |
21 |
Correct |
246 ms |
7024 KB |
Output is correct |
22 |
Correct |
264 ms |
6348 KB |
Output is correct |
23 |
Correct |
279 ms |
7020 KB |
Output is correct |
24 |
Correct |
288 ms |
7116 KB |
Output is correct |
25 |
Correct |
262 ms |
7184 KB |
Output is correct |
26 |
Correct |
280 ms |
6300 KB |
Output is correct |
27 |
Correct |
292 ms |
7232 KB |
Output is correct |
28 |
Correct |
294 ms |
7112 KB |
Output is correct |
29 |
Correct |
263 ms |
7240 KB |
Output is correct |
30 |
Correct |
279 ms |
6628 KB |
Output is correct |
31 |
Correct |
296 ms |
7340 KB |
Output is correct |
32 |
Correct |
304 ms |
7388 KB |
Output is correct |
33 |
Correct |
277 ms |
7500 KB |
Output is correct |
34 |
Correct |
301 ms |
6844 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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
6 ms |
600 KB |
Output is correct |
7 |
Correct |
14 ms |
856 KB |
Output is correct |
8 |
Correct |
34 ms |
1624 KB |
Output is correct |
9 |
Correct |
76 ms |
2488 KB |
Output is correct |
10 |
Correct |
3 ms |
600 KB |
Output is correct |
11 |
Correct |
48 ms |
2116 KB |
Output is correct |
12 |
Correct |
82 ms |
2648 KB |
Output is correct |
13 |
Correct |
74 ms |
2904 KB |
Output is correct |
14 |
Correct |
75 ms |
2580 KB |
Output is correct |
15 |
Correct |
266 ms |
6636 KB |
Output is correct |
16 |
Correct |
262 ms |
6600 KB |
Output is correct |
17 |
Correct |
242 ms |
6960 KB |
Output is correct |
18 |
Correct |
249 ms |
6088 KB |
Output is correct |
19 |
Correct |
268 ms |
6908 KB |
Output is correct |
20 |
Correct |
277 ms |
6860 KB |
Output is correct |
21 |
Correct |
246 ms |
7024 KB |
Output is correct |
22 |
Correct |
264 ms |
6348 KB |
Output is correct |
23 |
Correct |
279 ms |
7020 KB |
Output is correct |
24 |
Correct |
288 ms |
7116 KB |
Output is correct |
25 |
Correct |
262 ms |
7184 KB |
Output is correct |
26 |
Correct |
280 ms |
6300 KB |
Output is correct |
27 |
Correct |
292 ms |
7232 KB |
Output is correct |
28 |
Correct |
294 ms |
7112 KB |
Output is correct |
29 |
Correct |
263 ms |
7240 KB |
Output is correct |
30 |
Correct |
279 ms |
6628 KB |
Output is correct |
31 |
Correct |
296 ms |
7340 KB |
Output is correct |
32 |
Correct |
304 ms |
7388 KB |
Output is correct |
33 |
Correct |
277 ms |
7500 KB |
Output is correct |
34 |
Correct |
301 ms |
6844 KB |
Output is correct |
35 |
Incorrect |
312 ms |
7520 KB |
Wrong Answer [2] |
36 |
Halted |
0 ms |
0 KB |
- |