답안 #764386

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
764386 2023-06-23T11:17:14 Z Dan4Life Minerals (JOI19_minerals) C++17
100 / 100
40 ms 3364 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 = n*.4+.5;
    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) 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],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

minerals.cpp: In function 'void dnc(vi, vi, bool)':
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:19: 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]={{},{}};
      |                   ^~
# 결과 실행 시간 메모리 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 336 KB Output is correct
3 Correct 3 ms 592 KB Output is correct
4 Correct 6 ms 748 KB Output is correct
5 Correct 12 ms 1316 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 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 6 ms 748 KB Output is correct
9 Correct 12 ms 1316 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 12 ms 1360 KB Output is correct
13 Correct 12 ms 1300 KB Output is correct
14 Correct 12 ms 1232 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 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 6 ms 748 KB Output is correct
9 Correct 12 ms 1316 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 12 ms 1360 KB Output is correct
13 Correct 12 ms 1300 KB Output is correct
14 Correct 12 ms 1232 KB Output is correct
15 Correct 32 ms 2932 KB Output is correct
16 Correct 32 ms 2988 KB Output is correct
17 Correct 33 ms 2972 KB Output is correct
18 Correct 30 ms 2824 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 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 6 ms 748 KB Output is correct
9 Correct 12 ms 1316 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 12 ms 1360 KB Output is correct
13 Correct 12 ms 1300 KB Output is correct
14 Correct 12 ms 1232 KB Output is correct
15 Correct 32 ms 2932 KB Output is correct
16 Correct 32 ms 2988 KB Output is correct
17 Correct 33 ms 2972 KB Output is correct
18 Correct 30 ms 2824 KB Output is correct
19 Correct 38 ms 3032 KB Output is correct
20 Correct 37 ms 3052 KB Output is correct
21 Correct 31 ms 3012 KB Output is correct
22 Correct 31 ms 2840 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 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 6 ms 748 KB Output is correct
9 Correct 12 ms 1316 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 12 ms 1360 KB Output is correct
13 Correct 12 ms 1300 KB Output is correct
14 Correct 12 ms 1232 KB Output is correct
15 Correct 32 ms 2932 KB Output is correct
16 Correct 32 ms 2988 KB Output is correct
17 Correct 33 ms 2972 KB Output is correct
18 Correct 30 ms 2824 KB Output is correct
19 Correct 38 ms 3032 KB Output is correct
20 Correct 37 ms 3052 KB Output is correct
21 Correct 31 ms 3012 KB Output is correct
22 Correct 31 ms 2840 KB Output is correct
23 Correct 38 ms 3052 KB Output is correct
24 Correct 35 ms 3024 KB Output is correct
25 Correct 34 ms 3172 KB Output is correct
26 Correct 31 ms 2928 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 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 6 ms 748 KB Output is correct
9 Correct 12 ms 1316 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 12 ms 1360 KB Output is correct
13 Correct 12 ms 1300 KB Output is correct
14 Correct 12 ms 1232 KB Output is correct
15 Correct 32 ms 2932 KB Output is correct
16 Correct 32 ms 2988 KB Output is correct
17 Correct 33 ms 2972 KB Output is correct
18 Correct 30 ms 2824 KB Output is correct
19 Correct 38 ms 3032 KB Output is correct
20 Correct 37 ms 3052 KB Output is correct
21 Correct 31 ms 3012 KB Output is correct
22 Correct 31 ms 2840 KB Output is correct
23 Correct 38 ms 3052 KB Output is correct
24 Correct 35 ms 3024 KB Output is correct
25 Correct 34 ms 3172 KB Output is correct
26 Correct 31 ms 2928 KB Output is correct
27 Correct 35 ms 3160 KB Output is correct
28 Correct 35 ms 3228 KB Output is correct
29 Correct 32 ms 3168 KB Output is correct
30 Correct 32 ms 3076 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 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 6 ms 748 KB Output is correct
9 Correct 12 ms 1316 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 12 ms 1360 KB Output is correct
13 Correct 12 ms 1300 KB Output is correct
14 Correct 12 ms 1232 KB Output is correct
15 Correct 32 ms 2932 KB Output is correct
16 Correct 32 ms 2988 KB Output is correct
17 Correct 33 ms 2972 KB Output is correct
18 Correct 30 ms 2824 KB Output is correct
19 Correct 38 ms 3032 KB Output is correct
20 Correct 37 ms 3052 KB Output is correct
21 Correct 31 ms 3012 KB Output is correct
22 Correct 31 ms 2840 KB Output is correct
23 Correct 38 ms 3052 KB Output is correct
24 Correct 35 ms 3024 KB Output is correct
25 Correct 34 ms 3172 KB Output is correct
26 Correct 31 ms 2928 KB Output is correct
27 Correct 35 ms 3160 KB Output is correct
28 Correct 35 ms 3228 KB Output is correct
29 Correct 32 ms 3168 KB Output is correct
30 Correct 32 ms 3076 KB Output is correct
31 Correct 36 ms 3272 KB Output is correct
32 Correct 40 ms 3268 KB Output is correct
33 Correct 33 ms 3272 KB Output is correct
34 Correct 33 ms 3144 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 336 KB Output is correct
7 Correct 3 ms 592 KB Output is correct
8 Correct 6 ms 748 KB Output is correct
9 Correct 12 ms 1316 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 12 ms 1360 KB Output is correct
13 Correct 12 ms 1300 KB Output is correct
14 Correct 12 ms 1232 KB Output is correct
15 Correct 32 ms 2932 KB Output is correct
16 Correct 32 ms 2988 KB Output is correct
17 Correct 33 ms 2972 KB Output is correct
18 Correct 30 ms 2824 KB Output is correct
19 Correct 38 ms 3032 KB Output is correct
20 Correct 37 ms 3052 KB Output is correct
21 Correct 31 ms 3012 KB Output is correct
22 Correct 31 ms 2840 KB Output is correct
23 Correct 38 ms 3052 KB Output is correct
24 Correct 35 ms 3024 KB Output is correct
25 Correct 34 ms 3172 KB Output is correct
26 Correct 31 ms 2928 KB Output is correct
27 Correct 35 ms 3160 KB Output is correct
28 Correct 35 ms 3228 KB Output is correct
29 Correct 32 ms 3168 KB Output is correct
30 Correct 32 ms 3076 KB Output is correct
31 Correct 36 ms 3272 KB Output is correct
32 Correct 40 ms 3268 KB Output is correct
33 Correct 33 ms 3272 KB Output is correct
34 Correct 33 ms 3144 KB Output is correct
35 Correct 36 ms 3332 KB Output is correct
36 Correct 37 ms 3364 KB Output is correct
37 Correct 34 ms 3284 KB Output is correct
38 Correct 35 ms 3212 KB Output is correct