Submission #764412

# Submission time Handle Problem Language Result Execution time Memory
764412 2023-06-23T11:30:42 Z Dan4Life Minerals (JOI19_minerals) C++17
100 / 100
31 ms 3860 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, int d){
    int n = sz(l); int m = n*.3+.5;
    if(n<2) return Answer(l[0],r[0]); 
    if(d) m=n-m; vi w[2]={{},{}};
    for(int i = !!d*m; i < (!d?m:n); i++) Q(l[i]);
    for(int i : r) w[sz(w[0])==m?1:sz(w[1])==n-m?0:Q(i)].pb(i);
    dnc(vi(begin(l),begin(l)+m),w[0],1); 
    dnc(vi(begin(l)+m,end(l)),w[1],0);
}
 
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],1);
}

Compilation message

minerals.cpp: In function 'void dnc(vi, vi, int)':
minerals.cpp:13:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   13 |     if(d) m=n-m; vi w[2]={{},{}};
      |     ^~
minerals.cpp:13:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   13 |     if(d) m=n-m; vi w[2]={{},{}};
      |                  ^~
# Verdict Execution time Memory Grader output
1 Correct 0 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 336 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 848 KB Output is correct
5 Correct 9 ms 1444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 3 ms 592 KB Output is correct
8 Correct 7 ms 848 KB Output is correct
9 Correct 9 ms 1444 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1020 KB Output is correct
12 Correct 9 ms 1488 KB Output is correct
13 Correct 7 ms 1488 KB Output is correct
14 Correct 7 ms 1488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 3 ms 592 KB Output is correct
8 Correct 7 ms 848 KB Output is correct
9 Correct 9 ms 1444 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1020 KB Output is correct
12 Correct 9 ms 1488 KB Output is correct
13 Correct 7 ms 1488 KB Output is correct
14 Correct 7 ms 1488 KB Output is correct
15 Correct 25 ms 3456 KB Output is correct
16 Correct 25 ms 3400 KB Output is correct
17 Correct 18 ms 3404 KB Output is correct
18 Correct 20 ms 3200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 3 ms 592 KB Output is correct
8 Correct 7 ms 848 KB Output is correct
9 Correct 9 ms 1444 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1020 KB Output is correct
12 Correct 9 ms 1488 KB Output is correct
13 Correct 7 ms 1488 KB Output is correct
14 Correct 7 ms 1488 KB Output is correct
15 Correct 25 ms 3456 KB Output is correct
16 Correct 25 ms 3400 KB Output is correct
17 Correct 18 ms 3404 KB Output is correct
18 Correct 20 ms 3200 KB Output is correct
19 Correct 27 ms 3400 KB Output is correct
20 Correct 30 ms 3420 KB Output is correct
21 Correct 20 ms 3444 KB Output is correct
22 Correct 23 ms 3248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 3 ms 592 KB Output is correct
8 Correct 7 ms 848 KB Output is correct
9 Correct 9 ms 1444 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1020 KB Output is correct
12 Correct 9 ms 1488 KB Output is correct
13 Correct 7 ms 1488 KB Output is correct
14 Correct 7 ms 1488 KB Output is correct
15 Correct 25 ms 3456 KB Output is correct
16 Correct 25 ms 3400 KB Output is correct
17 Correct 18 ms 3404 KB Output is correct
18 Correct 20 ms 3200 KB Output is correct
19 Correct 27 ms 3400 KB Output is correct
20 Correct 30 ms 3420 KB Output is correct
21 Correct 20 ms 3444 KB Output is correct
22 Correct 23 ms 3248 KB Output is correct
23 Correct 26 ms 3500 KB Output is correct
24 Correct 31 ms 3576 KB Output is correct
25 Correct 22 ms 3596 KB Output is correct
26 Correct 20 ms 3424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 3 ms 592 KB Output is correct
8 Correct 7 ms 848 KB Output is correct
9 Correct 9 ms 1444 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1020 KB Output is correct
12 Correct 9 ms 1488 KB Output is correct
13 Correct 7 ms 1488 KB Output is correct
14 Correct 7 ms 1488 KB Output is correct
15 Correct 25 ms 3456 KB Output is correct
16 Correct 25 ms 3400 KB Output is correct
17 Correct 18 ms 3404 KB Output is correct
18 Correct 20 ms 3200 KB Output is correct
19 Correct 27 ms 3400 KB Output is correct
20 Correct 30 ms 3420 KB Output is correct
21 Correct 20 ms 3444 KB Output is correct
22 Correct 23 ms 3248 KB Output is correct
23 Correct 26 ms 3500 KB Output is correct
24 Correct 31 ms 3576 KB Output is correct
25 Correct 22 ms 3596 KB Output is correct
26 Correct 20 ms 3424 KB Output is correct
27 Correct 26 ms 3664 KB Output is correct
28 Correct 30 ms 3732 KB Output is correct
29 Correct 25 ms 3660 KB Output is correct
30 Correct 25 ms 3472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 3 ms 592 KB Output is correct
8 Correct 7 ms 848 KB Output is correct
9 Correct 9 ms 1444 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1020 KB Output is correct
12 Correct 9 ms 1488 KB Output is correct
13 Correct 7 ms 1488 KB Output is correct
14 Correct 7 ms 1488 KB Output is correct
15 Correct 25 ms 3456 KB Output is correct
16 Correct 25 ms 3400 KB Output is correct
17 Correct 18 ms 3404 KB Output is correct
18 Correct 20 ms 3200 KB Output is correct
19 Correct 27 ms 3400 KB Output is correct
20 Correct 30 ms 3420 KB Output is correct
21 Correct 20 ms 3444 KB Output is correct
22 Correct 23 ms 3248 KB Output is correct
23 Correct 26 ms 3500 KB Output is correct
24 Correct 31 ms 3576 KB Output is correct
25 Correct 22 ms 3596 KB Output is correct
26 Correct 20 ms 3424 KB Output is correct
27 Correct 26 ms 3664 KB Output is correct
28 Correct 30 ms 3732 KB Output is correct
29 Correct 25 ms 3660 KB Output is correct
30 Correct 25 ms 3472 KB Output is correct
31 Correct 28 ms 3676 KB Output is correct
32 Correct 28 ms 3696 KB Output is correct
33 Correct 25 ms 3688 KB Output is correct
34 Correct 21 ms 3600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 3 ms 592 KB Output is correct
8 Correct 7 ms 848 KB Output is correct
9 Correct 9 ms 1444 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 6 ms 1020 KB Output is correct
12 Correct 9 ms 1488 KB Output is correct
13 Correct 7 ms 1488 KB Output is correct
14 Correct 7 ms 1488 KB Output is correct
15 Correct 25 ms 3456 KB Output is correct
16 Correct 25 ms 3400 KB Output is correct
17 Correct 18 ms 3404 KB Output is correct
18 Correct 20 ms 3200 KB Output is correct
19 Correct 27 ms 3400 KB Output is correct
20 Correct 30 ms 3420 KB Output is correct
21 Correct 20 ms 3444 KB Output is correct
22 Correct 23 ms 3248 KB Output is correct
23 Correct 26 ms 3500 KB Output is correct
24 Correct 31 ms 3576 KB Output is correct
25 Correct 22 ms 3596 KB Output is correct
26 Correct 20 ms 3424 KB Output is correct
27 Correct 26 ms 3664 KB Output is correct
28 Correct 30 ms 3732 KB Output is correct
29 Correct 25 ms 3660 KB Output is correct
30 Correct 25 ms 3472 KB Output is correct
31 Correct 28 ms 3676 KB Output is correct
32 Correct 28 ms 3696 KB Output is correct
33 Correct 25 ms 3688 KB Output is correct
34 Correct 21 ms 3600 KB Output is correct
35 Correct 28 ms 3844 KB Output is correct
36 Correct 29 ms 3780 KB Output is correct
37 Correct 22 ms 3860 KB Output is correct
38 Correct 22 ms 3616 KB Output is correct