#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
int n;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int cur, pre;
bool Q(int i){ cur = Query(i); bool ok=(cur!=pre); pre=cur; return ok;}
void dnc(vector<int> l, vector<int> r, bool d){
int n = sz(l); int m = max(1.0,n*0.4); if(n<1) return;
if(n==1) return void(Answer(l[0],r[0]));
m = max(m, n-m);
vector<int> v[2], w[2];
for(int i : {0,1}) v[i].clear(), w[i].clear();
for(int i = (d?0:m); i < (d?m:n); i++) Q(l[i]);
for(int i = 0; i < n; i++) v[i>=m].pb(l[i]);
shuffle(all(r),rng);
for(int i : r){
if(sz(w[0])==m) w[1].pb(i);
else if(sz(w[1])==n-m) w[0].pb(i);
else w[Q(i)].pb(i);
}
dnc(v[0],w[0],0); dnc(v[1],w[1],1);
}
void Solve(int N) {
vector<int> w[2];
for(int i = 1; i <= 2*N; i++) w[Q(i)].pb(i);
dnc(w[0],w[1],0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
2 ms |
464 KB |
Output is correct |
3 |
Correct |
4 ms |
592 KB |
Output is correct |
4 |
Correct |
8 ms |
976 KB |
Output is correct |
5 |
Correct |
14 ms |
1508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
8 ms |
976 KB |
Output is correct |
9 |
Correct |
14 ms |
1508 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
9 ms |
1176 KB |
Output is correct |
12 |
Correct |
16 ms |
1536 KB |
Output is correct |
13 |
Correct |
14 ms |
1644 KB |
Output is correct |
14 |
Correct |
14 ms |
1520 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
8 ms |
976 KB |
Output is correct |
9 |
Correct |
14 ms |
1508 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
9 ms |
1176 KB |
Output is correct |
12 |
Correct |
16 ms |
1536 KB |
Output is correct |
13 |
Correct |
14 ms |
1644 KB |
Output is correct |
14 |
Correct |
14 ms |
1520 KB |
Output is correct |
15 |
Correct |
38 ms |
3452 KB |
Output is correct |
16 |
Correct |
43 ms |
3384 KB |
Output is correct |
17 |
Correct |
36 ms |
3448 KB |
Output is correct |
18 |
Correct |
37 ms |
3292 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
8 ms |
976 KB |
Output is correct |
9 |
Correct |
14 ms |
1508 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
9 ms |
1176 KB |
Output is correct |
12 |
Correct |
16 ms |
1536 KB |
Output is correct |
13 |
Correct |
14 ms |
1644 KB |
Output is correct |
14 |
Correct |
14 ms |
1520 KB |
Output is correct |
15 |
Correct |
38 ms |
3452 KB |
Output is correct |
16 |
Correct |
43 ms |
3384 KB |
Output is correct |
17 |
Correct |
36 ms |
3448 KB |
Output is correct |
18 |
Correct |
37 ms |
3292 KB |
Output is correct |
19 |
Correct |
45 ms |
3404 KB |
Output is correct |
20 |
Correct |
41 ms |
3504 KB |
Output is correct |
21 |
Correct |
40 ms |
3524 KB |
Output is correct |
22 |
Correct |
41 ms |
3332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
8 ms |
976 KB |
Output is correct |
9 |
Correct |
14 ms |
1508 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
9 ms |
1176 KB |
Output is correct |
12 |
Correct |
16 ms |
1536 KB |
Output is correct |
13 |
Correct |
14 ms |
1644 KB |
Output is correct |
14 |
Correct |
14 ms |
1520 KB |
Output is correct |
15 |
Correct |
38 ms |
3452 KB |
Output is correct |
16 |
Correct |
43 ms |
3384 KB |
Output is correct |
17 |
Correct |
36 ms |
3448 KB |
Output is correct |
18 |
Correct |
37 ms |
3292 KB |
Output is correct |
19 |
Correct |
45 ms |
3404 KB |
Output is correct |
20 |
Correct |
41 ms |
3504 KB |
Output is correct |
21 |
Correct |
40 ms |
3524 KB |
Output is correct |
22 |
Correct |
41 ms |
3332 KB |
Output is correct |
23 |
Correct |
50 ms |
3624 KB |
Output is correct |
24 |
Correct |
42 ms |
3604 KB |
Output is correct |
25 |
Correct |
38 ms |
3552 KB |
Output is correct |
26 |
Correct |
38 ms |
3400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
8 ms |
976 KB |
Output is correct |
9 |
Correct |
14 ms |
1508 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
9 ms |
1176 KB |
Output is correct |
12 |
Correct |
16 ms |
1536 KB |
Output is correct |
13 |
Correct |
14 ms |
1644 KB |
Output is correct |
14 |
Correct |
14 ms |
1520 KB |
Output is correct |
15 |
Correct |
38 ms |
3452 KB |
Output is correct |
16 |
Correct |
43 ms |
3384 KB |
Output is correct |
17 |
Correct |
36 ms |
3448 KB |
Output is correct |
18 |
Correct |
37 ms |
3292 KB |
Output is correct |
19 |
Correct |
45 ms |
3404 KB |
Output is correct |
20 |
Correct |
41 ms |
3504 KB |
Output is correct |
21 |
Correct |
40 ms |
3524 KB |
Output is correct |
22 |
Correct |
41 ms |
3332 KB |
Output is correct |
23 |
Correct |
50 ms |
3624 KB |
Output is correct |
24 |
Correct |
42 ms |
3604 KB |
Output is correct |
25 |
Correct |
38 ms |
3552 KB |
Output is correct |
26 |
Correct |
38 ms |
3400 KB |
Output is correct |
27 |
Correct |
48 ms |
3688 KB |
Output is correct |
28 |
Correct |
42 ms |
3684 KB |
Output is correct |
29 |
Correct |
40 ms |
3652 KB |
Output is correct |
30 |
Correct |
39 ms |
3528 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
8 ms |
976 KB |
Output is correct |
9 |
Correct |
14 ms |
1508 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
9 ms |
1176 KB |
Output is correct |
12 |
Correct |
16 ms |
1536 KB |
Output is correct |
13 |
Correct |
14 ms |
1644 KB |
Output is correct |
14 |
Correct |
14 ms |
1520 KB |
Output is correct |
15 |
Correct |
38 ms |
3452 KB |
Output is correct |
16 |
Correct |
43 ms |
3384 KB |
Output is correct |
17 |
Correct |
36 ms |
3448 KB |
Output is correct |
18 |
Correct |
37 ms |
3292 KB |
Output is correct |
19 |
Correct |
45 ms |
3404 KB |
Output is correct |
20 |
Correct |
41 ms |
3504 KB |
Output is correct |
21 |
Correct |
40 ms |
3524 KB |
Output is correct |
22 |
Correct |
41 ms |
3332 KB |
Output is correct |
23 |
Correct |
50 ms |
3624 KB |
Output is correct |
24 |
Correct |
42 ms |
3604 KB |
Output is correct |
25 |
Correct |
38 ms |
3552 KB |
Output is correct |
26 |
Correct |
38 ms |
3400 KB |
Output is correct |
27 |
Correct |
48 ms |
3688 KB |
Output is correct |
28 |
Correct |
42 ms |
3684 KB |
Output is correct |
29 |
Correct |
40 ms |
3652 KB |
Output is correct |
30 |
Correct |
39 ms |
3528 KB |
Output is correct |
31 |
Incorrect |
47 ms |
3776 KB |
Wrong Answer [2] |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
2 ms |
464 KB |
Output is correct |
7 |
Correct |
4 ms |
592 KB |
Output is correct |
8 |
Correct |
8 ms |
976 KB |
Output is correct |
9 |
Correct |
14 ms |
1508 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
9 ms |
1176 KB |
Output is correct |
12 |
Correct |
16 ms |
1536 KB |
Output is correct |
13 |
Correct |
14 ms |
1644 KB |
Output is correct |
14 |
Correct |
14 ms |
1520 KB |
Output is correct |
15 |
Correct |
38 ms |
3452 KB |
Output is correct |
16 |
Correct |
43 ms |
3384 KB |
Output is correct |
17 |
Correct |
36 ms |
3448 KB |
Output is correct |
18 |
Correct |
37 ms |
3292 KB |
Output is correct |
19 |
Correct |
45 ms |
3404 KB |
Output is correct |
20 |
Correct |
41 ms |
3504 KB |
Output is correct |
21 |
Correct |
40 ms |
3524 KB |
Output is correct |
22 |
Correct |
41 ms |
3332 KB |
Output is correct |
23 |
Correct |
50 ms |
3624 KB |
Output is correct |
24 |
Correct |
42 ms |
3604 KB |
Output is correct |
25 |
Correct |
38 ms |
3552 KB |
Output is correct |
26 |
Correct |
38 ms |
3400 KB |
Output is correct |
27 |
Correct |
48 ms |
3688 KB |
Output is correct |
28 |
Correct |
42 ms |
3684 KB |
Output is correct |
29 |
Correct |
40 ms |
3652 KB |
Output is correct |
30 |
Correct |
39 ms |
3528 KB |
Output is correct |
31 |
Incorrect |
47 ms |
3776 KB |
Wrong Answer [2] |
32 |
Halted |
0 ms |
0 KB |
- |