#include <bits/stdc++.h>
#include "minerals.h"
using namespace std;
#define For(i,a,b) for(int i=a;i<=b;i++)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
bool toggle(int x){
static int last=0;
int now=Query(x);
bool ans=(now==last);
last=now;
return ans;
}
void solve(vector<int> &vl,vector<int> &vr,int l,int r,bool fill){
if(sz(vl)==1){
Answer(vl[0],vr[l]);
return;
}
int n=max(1,sz(vl)/3);
int m=sz(vl)-n;
For(i,l,l+n-1) toggle(vr[i]);
vector<int> vll,vlr;
for(auto &i:vl){
if(sz(vll)==n) vlr.eb(i);
else if(sz(vlr)==m) vll.eb(i);
else{
bool res=toggle(i);
if(fill!=res) vll.eb(i);
else vlr.eb(i);
}
}
solve(vll,vr,l,l+n-1,!fill);
solve(vlr,vr,l+n,r,fill);
}
void Solve(int32_t n){
vector<int> l,r;
For(i,1,n*2){
if(toggle(i)) l.eb(i);
else r.eb(i);
}
random_shuffle(all(r));
solve(l,r,0,n-1,true);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
2 ms |
328 KB |
Output is correct |
3 |
Correct |
4 ms |
456 KB |
Output is correct |
4 |
Correct |
5 ms |
712 KB |
Output is correct |
5 |
Correct |
10 ms |
1064 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
456 KB |
Output is correct |
8 |
Correct |
5 ms |
712 KB |
Output is correct |
9 |
Correct |
10 ms |
1064 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
7 ms |
840 KB |
Output is correct |
12 |
Correct |
11 ms |
1096 KB |
Output is correct |
13 |
Correct |
13 ms |
1096 KB |
Output is correct |
14 |
Correct |
10 ms |
996 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
456 KB |
Output is correct |
8 |
Correct |
5 ms |
712 KB |
Output is correct |
9 |
Correct |
10 ms |
1064 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
7 ms |
840 KB |
Output is correct |
12 |
Correct |
11 ms |
1096 KB |
Output is correct |
13 |
Correct |
13 ms |
1096 KB |
Output is correct |
14 |
Correct |
10 ms |
996 KB |
Output is correct |
15 |
Correct |
29 ms |
2276 KB |
Output is correct |
16 |
Correct |
28 ms |
2236 KB |
Output is correct |
17 |
Correct |
28 ms |
2236 KB |
Output is correct |
18 |
Correct |
27 ms |
2112 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
456 KB |
Output is correct |
8 |
Correct |
5 ms |
712 KB |
Output is correct |
9 |
Correct |
10 ms |
1064 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
7 ms |
840 KB |
Output is correct |
12 |
Correct |
11 ms |
1096 KB |
Output is correct |
13 |
Correct |
13 ms |
1096 KB |
Output is correct |
14 |
Correct |
10 ms |
996 KB |
Output is correct |
15 |
Correct |
29 ms |
2276 KB |
Output is correct |
16 |
Correct |
28 ms |
2236 KB |
Output is correct |
17 |
Correct |
28 ms |
2236 KB |
Output is correct |
18 |
Correct |
27 ms |
2112 KB |
Output is correct |
19 |
Correct |
29 ms |
2300 KB |
Output is correct |
20 |
Correct |
29 ms |
2368 KB |
Output is correct |
21 |
Correct |
29 ms |
2328 KB |
Output is correct |
22 |
Correct |
28 ms |
2148 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
456 KB |
Output is correct |
8 |
Correct |
5 ms |
712 KB |
Output is correct |
9 |
Correct |
10 ms |
1064 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
7 ms |
840 KB |
Output is correct |
12 |
Correct |
11 ms |
1096 KB |
Output is correct |
13 |
Correct |
13 ms |
1096 KB |
Output is correct |
14 |
Correct |
10 ms |
996 KB |
Output is correct |
15 |
Correct |
29 ms |
2276 KB |
Output is correct |
16 |
Correct |
28 ms |
2236 KB |
Output is correct |
17 |
Correct |
28 ms |
2236 KB |
Output is correct |
18 |
Correct |
27 ms |
2112 KB |
Output is correct |
19 |
Correct |
29 ms |
2300 KB |
Output is correct |
20 |
Correct |
29 ms |
2368 KB |
Output is correct |
21 |
Correct |
29 ms |
2328 KB |
Output is correct |
22 |
Correct |
28 ms |
2148 KB |
Output is correct |
23 |
Correct |
31 ms |
2320 KB |
Output is correct |
24 |
Correct |
30 ms |
2432 KB |
Output is correct |
25 |
Correct |
28 ms |
2364 KB |
Output is correct |
26 |
Correct |
28 ms |
2240 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
456 KB |
Output is correct |
8 |
Correct |
5 ms |
712 KB |
Output is correct |
9 |
Correct |
10 ms |
1064 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
7 ms |
840 KB |
Output is correct |
12 |
Correct |
11 ms |
1096 KB |
Output is correct |
13 |
Correct |
13 ms |
1096 KB |
Output is correct |
14 |
Correct |
10 ms |
996 KB |
Output is correct |
15 |
Correct |
29 ms |
2276 KB |
Output is correct |
16 |
Correct |
28 ms |
2236 KB |
Output is correct |
17 |
Correct |
28 ms |
2236 KB |
Output is correct |
18 |
Correct |
27 ms |
2112 KB |
Output is correct |
19 |
Correct |
29 ms |
2300 KB |
Output is correct |
20 |
Correct |
29 ms |
2368 KB |
Output is correct |
21 |
Correct |
29 ms |
2328 KB |
Output is correct |
22 |
Correct |
28 ms |
2148 KB |
Output is correct |
23 |
Correct |
31 ms |
2320 KB |
Output is correct |
24 |
Correct |
30 ms |
2432 KB |
Output is correct |
25 |
Correct |
28 ms |
2364 KB |
Output is correct |
26 |
Correct |
28 ms |
2240 KB |
Output is correct |
27 |
Correct |
33 ms |
2396 KB |
Output is correct |
28 |
Correct |
31 ms |
2368 KB |
Output is correct |
29 |
Correct |
28 ms |
2452 KB |
Output is correct |
30 |
Correct |
29 ms |
2252 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
456 KB |
Output is correct |
8 |
Correct |
5 ms |
712 KB |
Output is correct |
9 |
Correct |
10 ms |
1064 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
7 ms |
840 KB |
Output is correct |
12 |
Correct |
11 ms |
1096 KB |
Output is correct |
13 |
Correct |
13 ms |
1096 KB |
Output is correct |
14 |
Correct |
10 ms |
996 KB |
Output is correct |
15 |
Correct |
29 ms |
2276 KB |
Output is correct |
16 |
Correct |
28 ms |
2236 KB |
Output is correct |
17 |
Correct |
28 ms |
2236 KB |
Output is correct |
18 |
Correct |
27 ms |
2112 KB |
Output is correct |
19 |
Correct |
29 ms |
2300 KB |
Output is correct |
20 |
Correct |
29 ms |
2368 KB |
Output is correct |
21 |
Correct |
29 ms |
2328 KB |
Output is correct |
22 |
Correct |
28 ms |
2148 KB |
Output is correct |
23 |
Correct |
31 ms |
2320 KB |
Output is correct |
24 |
Correct |
30 ms |
2432 KB |
Output is correct |
25 |
Correct |
28 ms |
2364 KB |
Output is correct |
26 |
Correct |
28 ms |
2240 KB |
Output is correct |
27 |
Correct |
33 ms |
2396 KB |
Output is correct |
28 |
Correct |
31 ms |
2368 KB |
Output is correct |
29 |
Correct |
28 ms |
2452 KB |
Output is correct |
30 |
Correct |
29 ms |
2252 KB |
Output is correct |
31 |
Correct |
35 ms |
2480 KB |
Output is correct |
32 |
Correct |
38 ms |
2536 KB |
Output is correct |
33 |
Correct |
36 ms |
2528 KB |
Output is correct |
34 |
Correct |
31 ms |
2352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
456 KB |
Output is correct |
8 |
Correct |
5 ms |
712 KB |
Output is correct |
9 |
Correct |
10 ms |
1064 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
7 ms |
840 KB |
Output is correct |
12 |
Correct |
11 ms |
1096 KB |
Output is correct |
13 |
Correct |
13 ms |
1096 KB |
Output is correct |
14 |
Correct |
10 ms |
996 KB |
Output is correct |
15 |
Correct |
29 ms |
2276 KB |
Output is correct |
16 |
Correct |
28 ms |
2236 KB |
Output is correct |
17 |
Correct |
28 ms |
2236 KB |
Output is correct |
18 |
Correct |
27 ms |
2112 KB |
Output is correct |
19 |
Correct |
29 ms |
2300 KB |
Output is correct |
20 |
Correct |
29 ms |
2368 KB |
Output is correct |
21 |
Correct |
29 ms |
2328 KB |
Output is correct |
22 |
Correct |
28 ms |
2148 KB |
Output is correct |
23 |
Correct |
31 ms |
2320 KB |
Output is correct |
24 |
Correct |
30 ms |
2432 KB |
Output is correct |
25 |
Correct |
28 ms |
2364 KB |
Output is correct |
26 |
Correct |
28 ms |
2240 KB |
Output is correct |
27 |
Correct |
33 ms |
2396 KB |
Output is correct |
28 |
Correct |
31 ms |
2368 KB |
Output is correct |
29 |
Correct |
28 ms |
2452 KB |
Output is correct |
30 |
Correct |
29 ms |
2252 KB |
Output is correct |
31 |
Correct |
35 ms |
2480 KB |
Output is correct |
32 |
Correct |
38 ms |
2536 KB |
Output is correct |
33 |
Correct |
36 ms |
2528 KB |
Output is correct |
34 |
Correct |
31 ms |
2352 KB |
Output is correct |
35 |
Correct |
34 ms |
2544 KB |
Output is correct |
36 |
Correct |
33 ms |
2540 KB |
Output is correct |
37 |
Correct |
37 ms |
2532 KB |
Output is correct |
38 |
Correct |
30 ms |
2276 KB |
Output is correct |