Submission #501677

# Submission time Handle Problem Language Result Execution time Memory
501677 2022-01-04T10:01:54 Z qwerasdfzxcl Minerals (JOI19_minerals) C++14
40 / 100
22 ms 2156 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;
                    Query(A[j]);
                }
            }
            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]]);
}
# Verdict Execution time Memory 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 0 ms 200 KB Output is correct
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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 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 7 ms 968 KB Output is correct
13 Correct 6 ms 968 KB Output is correct
14 Correct 9 ms 852 KB Output is correct
# Verdict Execution time Memory 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 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 7 ms 968 KB Output is correct
13 Correct 6 ms 968 KB Output is correct
14 Correct 9 ms 852 KB Output is correct
15 Correct 20 ms 1980 KB Output is correct
16 Correct 22 ms 1992 KB Output is correct
17 Correct 19 ms 2156 KB Output is correct
18 Incorrect 18 ms 1832 KB Wrong Answer [4]
# Verdict Execution time Memory 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 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 7 ms 968 KB Output is correct
13 Correct 6 ms 968 KB Output is correct
14 Correct 9 ms 852 KB Output is correct
15 Correct 20 ms 1980 KB Output is correct
16 Correct 22 ms 1992 KB Output is correct
17 Correct 19 ms 2156 KB Output is correct
18 Incorrect 18 ms 1832 KB Wrong Answer [4]
# Verdict Execution time Memory 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 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 7 ms 968 KB Output is correct
13 Correct 6 ms 968 KB Output is correct
14 Correct 9 ms 852 KB Output is correct
15 Correct 20 ms 1980 KB Output is correct
16 Correct 22 ms 1992 KB Output is correct
17 Correct 19 ms 2156 KB Output is correct
18 Incorrect 18 ms 1832 KB Wrong Answer [4]
# Verdict Execution time Memory 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 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 7 ms 968 KB Output is correct
13 Correct 6 ms 968 KB Output is correct
14 Correct 9 ms 852 KB Output is correct
15 Correct 20 ms 1980 KB Output is correct
16 Correct 22 ms 1992 KB Output is correct
17 Correct 19 ms 2156 KB Output is correct
18 Incorrect 18 ms 1832 KB Wrong Answer [4]
# Verdict Execution time Memory 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 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 7 ms 968 KB Output is correct
13 Correct 6 ms 968 KB Output is correct
14 Correct 9 ms 852 KB Output is correct
15 Correct 20 ms 1980 KB Output is correct
16 Correct 22 ms 1992 KB Output is correct
17 Correct 19 ms 2156 KB Output is correct
18 Incorrect 18 ms 1832 KB Wrong Answer [4]
# Verdict Execution time Memory 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 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 7 ms 968 KB Output is correct
13 Correct 6 ms 968 KB Output is correct
14 Correct 9 ms 852 KB Output is correct
15 Correct 20 ms 1980 KB Output is correct
16 Correct 22 ms 1992 KB Output is correct
17 Correct 19 ms 2156 KB Output is correct
18 Incorrect 18 ms 1832 KB Wrong Answer [4]