# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
764368 | 2023-06-23T11:11:44 Z | Dan4Life | Minerals (JOI19_minerals) | C++17 | 50 ms | 3848 KB |
#include "minerals.h" #include <bits/stdc++.h> using namespace std; using vi = vector<int>; #define pb push_back #define sz(a) (int)a.size() int cur, pre; bool Q(int i){ cur = Query(i); bool ok=(cur!=pre); pre=cur; return ok;} void dnc(vi l, vi r, bool d){ int n = sz(l); int m = max(1.0,n*0.3); if(n<1) return; if(n==1) return Answer(l[0],r[0]); if(!d) m=n-m; vi w[2]={{},{}}; for(int i = (d?0:m); i < (d?m:n); i++) Q(l[i]); random_shuffle(begin(r),end(r)); 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(vi(begin(l),begin(l)+m),w[0],0); dnc(vi(begin(l)+m,end(l)),w[1],1); } void Solve(int N) { vi w[2]; for(int i = 1; i <= 2*N; i++) w[Q(i)].pb(i); dnc(w[0],w[1],0); }
Compilation message
# | Verdict | Execution time | Memory | 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 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 464 KB | Output is correct |
3 | Correct | 3 ms | 592 KB | Output is correct |
4 | Correct | 7 ms | 944 KB | Output is correct |
5 | Correct | 12 ms | 1488 KB | Output is correct |
# | Verdict | Execution time | Memory | 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 | 380 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 3 ms | 592 KB | Output is correct |
8 | Correct | 7 ms | 944 KB | Output is correct |
9 | Correct | 12 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 8 ms | 1104 KB | Output is correct |
12 | Correct | 13 ms | 1488 KB | Output is correct |
13 | Correct | 14 ms | 1512 KB | Output is correct |
14 | Correct | 15 ms | 1496 KB | Output is correct |
# | Verdict | Execution time | Memory | 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 | 380 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 3 ms | 592 KB | Output is correct |
8 | Correct | 7 ms | 944 KB | Output is correct |
9 | Correct | 12 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 8 ms | 1104 KB | Output is correct |
12 | Correct | 13 ms | 1488 KB | Output is correct |
13 | Correct | 14 ms | 1512 KB | Output is correct |
14 | Correct | 15 ms | 1496 KB | Output is correct |
15 | Correct | 33 ms | 3372 KB | Output is correct |
16 | Correct | 34 ms | 3396 KB | Output is correct |
17 | Correct | 32 ms | 3320 KB | Output is correct |
18 | Correct | 36 ms | 3312 KB | Output is correct |
# | Verdict | Execution time | Memory | 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 | 380 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 3 ms | 592 KB | Output is correct |
8 | Correct | 7 ms | 944 KB | Output is correct |
9 | Correct | 12 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 8 ms | 1104 KB | Output is correct |
12 | Correct | 13 ms | 1488 KB | Output is correct |
13 | Correct | 14 ms | 1512 KB | Output is correct |
14 | Correct | 15 ms | 1496 KB | Output is correct |
15 | Correct | 33 ms | 3372 KB | Output is correct |
16 | Correct | 34 ms | 3396 KB | Output is correct |
17 | Correct | 32 ms | 3320 KB | Output is correct |
18 | Correct | 36 ms | 3312 KB | Output is correct |
19 | Correct | 34 ms | 3460 KB | Output is correct |
20 | Correct | 42 ms | 3452 KB | Output is correct |
21 | Correct | 33 ms | 3396 KB | Output is correct |
22 | Correct | 38 ms | 3276 KB | Output is correct |
# | Verdict | Execution time | Memory | 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 | 380 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 3 ms | 592 KB | Output is correct |
8 | Correct | 7 ms | 944 KB | Output is correct |
9 | Correct | 12 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 8 ms | 1104 KB | Output is correct |
12 | Correct | 13 ms | 1488 KB | Output is correct |
13 | Correct | 14 ms | 1512 KB | Output is correct |
14 | Correct | 15 ms | 1496 KB | Output is correct |
15 | Correct | 33 ms | 3372 KB | Output is correct |
16 | Correct | 34 ms | 3396 KB | Output is correct |
17 | Correct | 32 ms | 3320 KB | Output is correct |
18 | Correct | 36 ms | 3312 KB | Output is correct |
19 | Correct | 34 ms | 3460 KB | Output is correct |
20 | Correct | 42 ms | 3452 KB | Output is correct |
21 | Correct | 33 ms | 3396 KB | Output is correct |
22 | Correct | 38 ms | 3276 KB | Output is correct |
23 | Correct | 37 ms | 3536 KB | Output is correct |
24 | Correct | 36 ms | 3608 KB | Output is correct |
25 | Correct | 39 ms | 3524 KB | Output is correct |
26 | Correct | 33 ms | 3400 KB | Output is correct |
# | Verdict | Execution time | Memory | 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 | 380 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 3 ms | 592 KB | Output is correct |
8 | Correct | 7 ms | 944 KB | Output is correct |
9 | Correct | 12 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 8 ms | 1104 KB | Output is correct |
12 | Correct | 13 ms | 1488 KB | Output is correct |
13 | Correct | 14 ms | 1512 KB | Output is correct |
14 | Correct | 15 ms | 1496 KB | Output is correct |
15 | Correct | 33 ms | 3372 KB | Output is correct |
16 | Correct | 34 ms | 3396 KB | Output is correct |
17 | Correct | 32 ms | 3320 KB | Output is correct |
18 | Correct | 36 ms | 3312 KB | Output is correct |
19 | Correct | 34 ms | 3460 KB | Output is correct |
20 | Correct | 42 ms | 3452 KB | Output is correct |
21 | Correct | 33 ms | 3396 KB | Output is correct |
22 | Correct | 38 ms | 3276 KB | Output is correct |
23 | Correct | 37 ms | 3536 KB | Output is correct |
24 | Correct | 36 ms | 3608 KB | Output is correct |
25 | Correct | 39 ms | 3524 KB | Output is correct |
26 | Correct | 33 ms | 3400 KB | Output is correct |
27 | Correct | 41 ms | 3684 KB | Output is correct |
28 | Correct | 37 ms | 3548 KB | Output is correct |
29 | Correct | 36 ms | 3668 KB | Output is correct |
30 | Correct | 35 ms | 3472 KB | Output is correct |
# | Verdict | Execution time | Memory | 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 | 380 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 3 ms | 592 KB | Output is correct |
8 | Correct | 7 ms | 944 KB | Output is correct |
9 | Correct | 12 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 8 ms | 1104 KB | Output is correct |
12 | Correct | 13 ms | 1488 KB | Output is correct |
13 | Correct | 14 ms | 1512 KB | Output is correct |
14 | Correct | 15 ms | 1496 KB | Output is correct |
15 | Correct | 33 ms | 3372 KB | Output is correct |
16 | Correct | 34 ms | 3396 KB | Output is correct |
17 | Correct | 32 ms | 3320 KB | Output is correct |
18 | Correct | 36 ms | 3312 KB | Output is correct |
19 | Correct | 34 ms | 3460 KB | Output is correct |
20 | Correct | 42 ms | 3452 KB | Output is correct |
21 | Correct | 33 ms | 3396 KB | Output is correct |
22 | Correct | 38 ms | 3276 KB | Output is correct |
23 | Correct | 37 ms | 3536 KB | Output is correct |
24 | Correct | 36 ms | 3608 KB | Output is correct |
25 | Correct | 39 ms | 3524 KB | Output is correct |
26 | Correct | 33 ms | 3400 KB | Output is correct |
27 | Correct | 41 ms | 3684 KB | Output is correct |
28 | Correct | 37 ms | 3548 KB | Output is correct |
29 | Correct | 36 ms | 3668 KB | Output is correct |
30 | Correct | 35 ms | 3472 KB | Output is correct |
31 | Correct | 42 ms | 3756 KB | Output is correct |
32 | Correct | 39 ms | 3660 KB | Output is correct |
33 | Correct | 35 ms | 3744 KB | Output is correct |
34 | Correct | 35 ms | 3560 KB | Output is correct |
# | Verdict | Execution time | Memory | 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 | 380 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 3 ms | 592 KB | Output is correct |
8 | Correct | 7 ms | 944 KB | Output is correct |
9 | Correct | 12 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 8 ms | 1104 KB | Output is correct |
12 | Correct | 13 ms | 1488 KB | Output is correct |
13 | Correct | 14 ms | 1512 KB | Output is correct |
14 | Correct | 15 ms | 1496 KB | Output is correct |
15 | Correct | 33 ms | 3372 KB | Output is correct |
16 | Correct | 34 ms | 3396 KB | Output is correct |
17 | Correct | 32 ms | 3320 KB | Output is correct |
18 | Correct | 36 ms | 3312 KB | Output is correct |
19 | Correct | 34 ms | 3460 KB | Output is correct |
20 | Correct | 42 ms | 3452 KB | Output is correct |
21 | Correct | 33 ms | 3396 KB | Output is correct |
22 | Correct | 38 ms | 3276 KB | Output is correct |
23 | Correct | 37 ms | 3536 KB | Output is correct |
24 | Correct | 36 ms | 3608 KB | Output is correct |
25 | Correct | 39 ms | 3524 KB | Output is correct |
26 | Correct | 33 ms | 3400 KB | Output is correct |
27 | Correct | 41 ms | 3684 KB | Output is correct |
28 | Correct | 37 ms | 3548 KB | Output is correct |
29 | Correct | 36 ms | 3668 KB | Output is correct |
30 | Correct | 35 ms | 3472 KB | Output is correct |
31 | Correct | 42 ms | 3756 KB | Output is correct |
32 | Correct | 39 ms | 3660 KB | Output is correct |
33 | Correct | 35 ms | 3744 KB | Output is correct |
34 | Correct | 35 ms | 3560 KB | Output is correct |
35 | Correct | 40 ms | 3808 KB | Output is correct |
36 | Correct | 50 ms | 3800 KB | Output is correct |
37 | Correct | 43 ms | 3848 KB | Output is correct |
38 | Correct | 36 ms | 3600 KB | Output is correct |