답안 #512691

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
512691 2022-01-16T16:44:30 Z couplefire Minerals (JOI19_minerals) C++17
100 / 100
88 ms 3136 KB
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int curr = 0;
 
bool change(int u){
    int nxt = Query(u);
    bool res = (nxt != curr);
    curr = nxt;
    return res;
}
 
void rec(vector<int> &A,vector<int> &B,bool rev){
    int len = A.size();
    if(len == 1){
        Answer(A[0],B[0]);
        return;
    }
    shuffle(A.begin(),A.end(),rng);
    shuffle(B.begin(),B.end(),rng);
    int mid = (rev?382:618)*len/1000;
    if(mid == 0) mid++;
    if(mid == len) mid--;
    vector<int> nA[2],nB[2];
    for(int i=0;i<len;i++){
        if(i < mid) nA[0].push_back(A[i]);
        else nA[1].push_back(A[i]);
        if((mid <= i) ^ rev) change(A[i]);
    }
    for(int i=0;i<len;i++){
        if(nB[0].size() == nA[0].size()) nB[1].push_back(B[i]);
        else if(nB[1].size() == nA[1].size()) nB[0].push_back(B[i]);
        else if(change(B[i])) nB[0].push_back(B[i]);
        else nB[1].push_back(B[i]);
    }
    rec(nA[0],nB[0],0);
    rec(nA[1],nB[1],1);
}
 
void Solve(int N){
    vector<int> group[2];
    for(int i=1;i<=2*N;i++) group[change(i)].push_back(i);
    rec(group[0],group[1],1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 2 ms 328 KB Output is correct
3 Correct 6 ms 456 KB Output is correct
4 Correct 12 ms 768 KB Output is correct
5 Correct 20 ms 1236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 6 ms 456 KB Output is correct
8 Correct 12 ms 768 KB Output is correct
9 Correct 20 ms 1236 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 968 KB Output is correct
12 Correct 20 ms 1212 KB Output is correct
13 Correct 23 ms 1200 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 6 ms 456 KB Output is correct
8 Correct 12 ms 768 KB Output is correct
9 Correct 20 ms 1236 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 968 KB Output is correct
12 Correct 20 ms 1212 KB Output is correct
13 Correct 23 ms 1200 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
15 Correct 57 ms 2764 KB Output is correct
16 Correct 57 ms 2732 KB Output is correct
17 Correct 56 ms 2792 KB Output is correct
18 Correct 58 ms 2488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 6 ms 456 KB Output is correct
8 Correct 12 ms 768 KB Output is correct
9 Correct 20 ms 1236 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 968 KB Output is correct
12 Correct 20 ms 1212 KB Output is correct
13 Correct 23 ms 1200 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
15 Correct 57 ms 2764 KB Output is correct
16 Correct 57 ms 2732 KB Output is correct
17 Correct 56 ms 2792 KB Output is correct
18 Correct 58 ms 2488 KB Output is correct
19 Correct 61 ms 2748 KB Output is correct
20 Correct 58 ms 2768 KB Output is correct
21 Correct 71 ms 2800 KB Output is correct
22 Correct 57 ms 2584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 6 ms 456 KB Output is correct
8 Correct 12 ms 768 KB Output is correct
9 Correct 20 ms 1236 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 968 KB Output is correct
12 Correct 20 ms 1212 KB Output is correct
13 Correct 23 ms 1200 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
15 Correct 57 ms 2764 KB Output is correct
16 Correct 57 ms 2732 KB Output is correct
17 Correct 56 ms 2792 KB Output is correct
18 Correct 58 ms 2488 KB Output is correct
19 Correct 61 ms 2748 KB Output is correct
20 Correct 58 ms 2768 KB Output is correct
21 Correct 71 ms 2800 KB Output is correct
22 Correct 57 ms 2584 KB Output is correct
23 Correct 64 ms 2812 KB Output is correct
24 Correct 62 ms 2776 KB Output is correct
25 Correct 60 ms 2796 KB Output is correct
26 Correct 65 ms 2620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 6 ms 456 KB Output is correct
8 Correct 12 ms 768 KB Output is correct
9 Correct 20 ms 1236 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 968 KB Output is correct
12 Correct 20 ms 1212 KB Output is correct
13 Correct 23 ms 1200 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
15 Correct 57 ms 2764 KB Output is correct
16 Correct 57 ms 2732 KB Output is correct
17 Correct 56 ms 2792 KB Output is correct
18 Correct 58 ms 2488 KB Output is correct
19 Correct 61 ms 2748 KB Output is correct
20 Correct 58 ms 2768 KB Output is correct
21 Correct 71 ms 2800 KB Output is correct
22 Correct 57 ms 2584 KB Output is correct
23 Correct 64 ms 2812 KB Output is correct
24 Correct 62 ms 2776 KB Output is correct
25 Correct 60 ms 2796 KB Output is correct
26 Correct 65 ms 2620 KB Output is correct
27 Correct 65 ms 2924 KB Output is correct
28 Correct 75 ms 2912 KB Output is correct
29 Correct 61 ms 2876 KB Output is correct
30 Correct 60 ms 2768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 6 ms 456 KB Output is correct
8 Correct 12 ms 768 KB Output is correct
9 Correct 20 ms 1236 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 968 KB Output is correct
12 Correct 20 ms 1212 KB Output is correct
13 Correct 23 ms 1200 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
15 Correct 57 ms 2764 KB Output is correct
16 Correct 57 ms 2732 KB Output is correct
17 Correct 56 ms 2792 KB Output is correct
18 Correct 58 ms 2488 KB Output is correct
19 Correct 61 ms 2748 KB Output is correct
20 Correct 58 ms 2768 KB Output is correct
21 Correct 71 ms 2800 KB Output is correct
22 Correct 57 ms 2584 KB Output is correct
23 Correct 64 ms 2812 KB Output is correct
24 Correct 62 ms 2776 KB Output is correct
25 Correct 60 ms 2796 KB Output is correct
26 Correct 65 ms 2620 KB Output is correct
27 Correct 65 ms 2924 KB Output is correct
28 Correct 75 ms 2912 KB Output is correct
29 Correct 61 ms 2876 KB Output is correct
30 Correct 60 ms 2768 KB Output is correct
31 Correct 65 ms 2924 KB Output is correct
32 Correct 63 ms 3136 KB Output is correct
33 Correct 78 ms 2968 KB Output is correct
34 Correct 65 ms 2796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 200 KB Output is correct
2 Correct 0 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 2 ms 328 KB Output is correct
7 Correct 6 ms 456 KB Output is correct
8 Correct 12 ms 768 KB Output is correct
9 Correct 20 ms 1236 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 14 ms 968 KB Output is correct
12 Correct 20 ms 1212 KB Output is correct
13 Correct 23 ms 1200 KB Output is correct
14 Correct 21 ms 1224 KB Output is correct
15 Correct 57 ms 2764 KB Output is correct
16 Correct 57 ms 2732 KB Output is correct
17 Correct 56 ms 2792 KB Output is correct
18 Correct 58 ms 2488 KB Output is correct
19 Correct 61 ms 2748 KB Output is correct
20 Correct 58 ms 2768 KB Output is correct
21 Correct 71 ms 2800 KB Output is correct
22 Correct 57 ms 2584 KB Output is correct
23 Correct 64 ms 2812 KB Output is correct
24 Correct 62 ms 2776 KB Output is correct
25 Correct 60 ms 2796 KB Output is correct
26 Correct 65 ms 2620 KB Output is correct
27 Correct 65 ms 2924 KB Output is correct
28 Correct 75 ms 2912 KB Output is correct
29 Correct 61 ms 2876 KB Output is correct
30 Correct 60 ms 2768 KB Output is correct
31 Correct 65 ms 2924 KB Output is correct
32 Correct 63 ms 3136 KB Output is correct
33 Correct 78 ms 2968 KB Output is correct
34 Correct 65 ms 2796 KB Output is correct
35 Correct 68 ms 3040 KB Output is correct
36 Correct 88 ms 3000 KB Output is correct
37 Correct 71 ms 2988 KB Output is correct
38 Correct 69 ms 2816 KB Output is correct