답안 #779335

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
779335 2023-07-11T10:46:33 Z bachhoangxuan Minerals (JOI19_minerals) C++17
100 / 100
39 ms 3452 KB
#include "minerals.h"
#include<bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int lst=0;
int query(int x){
    int cur=Query(x);
    int dif=(lst!=cur);lst=cur;
    return dif;
}
void dnc(vector<int> l,vector<int> r,bool f){
    int n=(int)l.size(),m=ceil(n*0.36);
    if(n==1) return Answer(l[0],r[0]);
    if(f) m=n-m;
    if(f) for(int i=n-1;i>=m;i--) query(l[i]);
    else for(int i=0;i<m;i++) query(l[i]);
    vector<int> lt,rt;
    shuffle(r.begin(),r.end(),rng);
    for(int x:r){
        if((int)lt.size()==m) rt.push_back(x);
        else if((int)rt.size()==n-m) lt.push_back(x);
        else if(query(x)) rt.push_back(x);
        else lt.push_back(x);
    }
    dnc(vector<int>(l.begin(),l.begin()+m),lt,true);
    dnc(vector<int>(l.begin()+m,l.end()),rt,false);
}
void Solve(int N) {
    vector<int> l,r;
    for(int i=1;i<=2*N;i++){
        if(query(i)) l.push_back(i);
        else r.push_back(i);
    }
    dnc(l,r,true);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 2 ms 452 KB Output is correct
3 Correct 4 ms 592 KB Output is correct
4 Correct 6 ms 848 KB Output is correct
5 Correct 12 ms 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 452 KB Output is correct
7 Correct 4 ms 592 KB Output is correct
8 Correct 6 ms 848 KB Output is correct
9 Correct 12 ms 1360 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 452 KB Output is correct
7 Correct 4 ms 592 KB Output is correct
8 Correct 6 ms 848 KB Output is correct
9 Correct 12 ms 1360 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1380 KB Output is correct
15 Correct 39 ms 3308 KB Output is correct
16 Correct 33 ms 3132 KB Output is correct
17 Correct 31 ms 3092 KB Output is correct
18 Correct 31 ms 2956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 452 KB Output is correct
7 Correct 4 ms 592 KB Output is correct
8 Correct 6 ms 848 KB Output is correct
9 Correct 12 ms 1360 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1380 KB Output is correct
15 Correct 39 ms 3308 KB Output is correct
16 Correct 33 ms 3132 KB Output is correct
17 Correct 31 ms 3092 KB Output is correct
18 Correct 31 ms 2956 KB Output is correct
19 Correct 33 ms 3208 KB Output is correct
20 Correct 39 ms 3220 KB Output is correct
21 Correct 32 ms 3128 KB Output is correct
22 Correct 32 ms 2964 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 452 KB Output is correct
7 Correct 4 ms 592 KB Output is correct
8 Correct 6 ms 848 KB Output is correct
9 Correct 12 ms 1360 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1380 KB Output is correct
15 Correct 39 ms 3308 KB Output is correct
16 Correct 33 ms 3132 KB Output is correct
17 Correct 31 ms 3092 KB Output is correct
18 Correct 31 ms 2956 KB Output is correct
19 Correct 33 ms 3208 KB Output is correct
20 Correct 39 ms 3220 KB Output is correct
21 Correct 32 ms 3128 KB Output is correct
22 Correct 32 ms 2964 KB Output is correct
23 Correct 34 ms 3280 KB Output is correct
24 Correct 35 ms 3272 KB Output is correct
25 Correct 37 ms 3288 KB Output is correct
26 Correct 33 ms 3092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 452 KB Output is correct
7 Correct 4 ms 592 KB Output is correct
8 Correct 6 ms 848 KB Output is correct
9 Correct 12 ms 1360 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1380 KB Output is correct
15 Correct 39 ms 3308 KB Output is correct
16 Correct 33 ms 3132 KB Output is correct
17 Correct 31 ms 3092 KB Output is correct
18 Correct 31 ms 2956 KB Output is correct
19 Correct 33 ms 3208 KB Output is correct
20 Correct 39 ms 3220 KB Output is correct
21 Correct 32 ms 3128 KB Output is correct
22 Correct 32 ms 2964 KB Output is correct
23 Correct 34 ms 3280 KB Output is correct
24 Correct 35 ms 3272 KB Output is correct
25 Correct 37 ms 3288 KB Output is correct
26 Correct 33 ms 3092 KB Output is correct
27 Correct 39 ms 3320 KB Output is correct
28 Correct 37 ms 3340 KB Output is correct
29 Correct 34 ms 3268 KB Output is correct
30 Correct 37 ms 3324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 452 KB Output is correct
7 Correct 4 ms 592 KB Output is correct
8 Correct 6 ms 848 KB Output is correct
9 Correct 12 ms 1360 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1380 KB Output is correct
15 Correct 39 ms 3308 KB Output is correct
16 Correct 33 ms 3132 KB Output is correct
17 Correct 31 ms 3092 KB Output is correct
18 Correct 31 ms 2956 KB Output is correct
19 Correct 33 ms 3208 KB Output is correct
20 Correct 39 ms 3220 KB Output is correct
21 Correct 32 ms 3128 KB Output is correct
22 Correct 32 ms 2964 KB Output is correct
23 Correct 34 ms 3280 KB Output is correct
24 Correct 35 ms 3272 KB Output is correct
25 Correct 37 ms 3288 KB Output is correct
26 Correct 33 ms 3092 KB Output is correct
27 Correct 39 ms 3320 KB Output is correct
28 Correct 37 ms 3340 KB Output is correct
29 Correct 34 ms 3268 KB Output is correct
30 Correct 37 ms 3324 KB Output is correct
31 Correct 36 ms 3328 KB Output is correct
32 Correct 36 ms 3404 KB Output is correct
33 Correct 39 ms 3408 KB Output is correct
34 Correct 36 ms 3236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 2 ms 452 KB Output is correct
7 Correct 4 ms 592 KB Output is correct
8 Correct 6 ms 848 KB Output is correct
9 Correct 12 ms 1360 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 8 ms 976 KB Output is correct
12 Correct 14 ms 1360 KB Output is correct
13 Correct 12 ms 1360 KB Output is correct
14 Correct 12 ms 1380 KB Output is correct
15 Correct 39 ms 3308 KB Output is correct
16 Correct 33 ms 3132 KB Output is correct
17 Correct 31 ms 3092 KB Output is correct
18 Correct 31 ms 2956 KB Output is correct
19 Correct 33 ms 3208 KB Output is correct
20 Correct 39 ms 3220 KB Output is correct
21 Correct 32 ms 3128 KB Output is correct
22 Correct 32 ms 2964 KB Output is correct
23 Correct 34 ms 3280 KB Output is correct
24 Correct 35 ms 3272 KB Output is correct
25 Correct 37 ms 3288 KB Output is correct
26 Correct 33 ms 3092 KB Output is correct
27 Correct 39 ms 3320 KB Output is correct
28 Correct 37 ms 3340 KB Output is correct
29 Correct 34 ms 3268 KB Output is correct
30 Correct 37 ms 3324 KB Output is correct
31 Correct 36 ms 3328 KB Output is correct
32 Correct 36 ms 3404 KB Output is correct
33 Correct 39 ms 3408 KB Output is correct
34 Correct 36 ms 3236 KB Output is correct
35 Correct 37 ms 3452 KB Output is correct
36 Correct 37 ms 3408 KB Output is correct
37 Correct 35 ms 3440 KB Output is correct
38 Correct 37 ms 3260 KB Output is correct