답안 #501676

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
501676 2022-01-04T09:59:14 Z qwerasdfzxcl Minerals (JOI19_minerals) C++14
40 / 100
11 ms 3280 KB
#include "minerals.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

void Solve(int N) {
    vector<int> A, B, ans(N);

    int cur = 0;
    bool flag = 0;
    for (int i=1;i<=N*2;i++){
        int tmp = Query(i);
        if (tmp!=cur) A.push_back(i);
        else B.push_back(i);

        if (flag) ans[(int)A.size()-1] |= 1<<15;

        if (tmp==cur && B.size()==32768){
            for (int j=0;j<(int)A.size();j++){
                int tmp2 = Query(A[j]);
                if (tmp!=tmp2) ans[j] |= 1<<15;
                tmp = tmp2;
            }
            flag = 1;
        }

        cur = tmp;
    }

    for (int i=0;i<N;i++) if (!(i&1)){
        cur = Query(B[i]);
    }

    //printf("YES\n");

    for (int j=0;j<15;j++){
        for (int i=0;i<N;i++){
            if ((ans[i]|(1<<j)) >= N) continue;
            int tmp = Query(A[i]);
            if (tmp==cur) ans[i] |= 1<<j;
            cur = tmp;
        }

        if (j==14) break;
        for (int i=0;i<N;i++) if (((i>>j)&1) ^ ((i>>(j+1))&1)){
            cur = Query(B[i]);
        }
    }

    //for (int i=0;i<N;i++) printf("%d ", ans[i]);

    for (int i=0;i<N;i++) Answer(A[i], B[ans[i]]);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 2 ms 456 KB Output is correct
4 Correct 4 ms 584 KB Output is correct
5 Correct 8 ms 840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 8 ms 840 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 5 ms 712 KB Output is correct
12 Correct 10 ms 924 KB Output is correct
13 Correct 8 ms 968 KB Output is correct
14 Correct 7 ms 996 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 8 ms 840 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 5 ms 712 KB Output is correct
12 Correct 10 ms 924 KB Output is correct
13 Correct 8 ms 968 KB Output is correct
14 Correct 7 ms 996 KB Output is correct
15 Runtime error 11 ms 3280 KB Execution killed with signal 11
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 8 ms 840 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 5 ms 712 KB Output is correct
12 Correct 10 ms 924 KB Output is correct
13 Correct 8 ms 968 KB Output is correct
14 Correct 7 ms 996 KB Output is correct
15 Runtime error 11 ms 3280 KB Execution killed with signal 11
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 8 ms 840 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 5 ms 712 KB Output is correct
12 Correct 10 ms 924 KB Output is correct
13 Correct 8 ms 968 KB Output is correct
14 Correct 7 ms 996 KB Output is correct
15 Runtime error 11 ms 3280 KB Execution killed with signal 11
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 8 ms 840 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 5 ms 712 KB Output is correct
12 Correct 10 ms 924 KB Output is correct
13 Correct 8 ms 968 KB Output is correct
14 Correct 7 ms 996 KB Output is correct
15 Runtime error 11 ms 3280 KB Execution killed with signal 11
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 8 ms 840 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 5 ms 712 KB Output is correct
12 Correct 10 ms 924 KB Output is correct
13 Correct 8 ms 968 KB Output is correct
14 Correct 7 ms 996 KB Output is correct
15 Runtime error 11 ms 3280 KB Execution killed with signal 11
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 0 ms 200 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 8 ms 840 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
11 Correct 5 ms 712 KB Output is correct
12 Correct 10 ms 924 KB Output is correct
13 Correct 8 ms 968 KB Output is correct
14 Correct 7 ms 996 KB Output is correct
15 Runtime error 11 ms 3280 KB Execution killed with signal 11
16 Halted 0 ms 0 KB -