Submission #501665

# Submission time Handle Problem Language Result Execution time Memory
501665 2022-01-04T09:24:37 Z qwerasdfzxcl Minerals (JOI19_minerals) C++14
75 / 100
22 ms 2172 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;
    for (int i=1;i<=N*2;i++){
        int tmp = Query(i);
        if (tmp==cur) A.push_back(i);
        else B.push_back(i);
        cur = tmp;
    }

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

    //printf("YES\n");

    for (int j=0;j<16;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==15) 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 0 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 376 KB Output is correct
4 Correct 4 ms 584 KB Output is correct
5 Correct 11 ms 840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 376 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 11 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 8 ms 896 KB Output is correct
13 Correct 7 ms 968 KB Output is correct
14 Correct 9 ms 840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 376 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 11 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 8 ms 896 KB Output is correct
13 Correct 7 ms 968 KB Output is correct
14 Correct 9 ms 840 KB Output is correct
15 Correct 22 ms 2044 KB Output is correct
16 Correct 21 ms 1992 KB Output is correct
17 Correct 17 ms 2108 KB Output is correct
18 Correct 21 ms 1900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 376 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 11 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 8 ms 896 KB Output is correct
13 Correct 7 ms 968 KB Output is correct
14 Correct 9 ms 840 KB Output is correct
15 Correct 22 ms 2044 KB Output is correct
16 Correct 21 ms 1992 KB Output is correct
17 Correct 17 ms 2108 KB Output is correct
18 Correct 21 ms 1900 KB Output is correct
19 Correct 22 ms 2072 KB Output is correct
20 Correct 21 ms 2000 KB Output is correct
21 Correct 16 ms 2172 KB Output is correct
22 Correct 17 ms 1856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 376 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 11 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 8 ms 896 KB Output is correct
13 Correct 7 ms 968 KB Output is correct
14 Correct 9 ms 840 KB Output is correct
15 Correct 22 ms 2044 KB Output is correct
16 Correct 21 ms 1992 KB Output is correct
17 Correct 17 ms 2108 KB Output is correct
18 Correct 21 ms 1900 KB Output is correct
19 Correct 22 ms 2072 KB Output is correct
20 Correct 21 ms 2000 KB Output is correct
21 Correct 16 ms 2172 KB Output is correct
22 Correct 17 ms 1856 KB Output is correct
23 Incorrect 22 ms 1880 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 376 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 11 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 8 ms 896 KB Output is correct
13 Correct 7 ms 968 KB Output is correct
14 Correct 9 ms 840 KB Output is correct
15 Correct 22 ms 2044 KB Output is correct
16 Correct 21 ms 1992 KB Output is correct
17 Correct 17 ms 2108 KB Output is correct
18 Correct 21 ms 1900 KB Output is correct
19 Correct 22 ms 2072 KB Output is correct
20 Correct 21 ms 2000 KB Output is correct
21 Correct 16 ms 2172 KB Output is correct
22 Correct 17 ms 1856 KB Output is correct
23 Incorrect 22 ms 1880 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 376 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 11 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 8 ms 896 KB Output is correct
13 Correct 7 ms 968 KB Output is correct
14 Correct 9 ms 840 KB Output is correct
15 Correct 22 ms 2044 KB Output is correct
16 Correct 21 ms 1992 KB Output is correct
17 Correct 17 ms 2108 KB Output is correct
18 Correct 21 ms 1900 KB Output is correct
19 Correct 22 ms 2072 KB Output is correct
20 Correct 21 ms 2000 KB Output is correct
21 Correct 16 ms 2172 KB Output is correct
22 Correct 17 ms 1856 KB Output is correct
23 Incorrect 22 ms 1880 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 376 KB Output is correct
8 Correct 4 ms 584 KB Output is correct
9 Correct 11 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 8 ms 896 KB Output is correct
13 Correct 7 ms 968 KB Output is correct
14 Correct 9 ms 840 KB Output is correct
15 Correct 22 ms 2044 KB Output is correct
16 Correct 21 ms 1992 KB Output is correct
17 Correct 17 ms 2108 KB Output is correct
18 Correct 21 ms 1900 KB Output is correct
19 Correct 22 ms 2072 KB Output is correct
20 Correct 21 ms 2000 KB Output is correct
21 Correct 16 ms 2172 KB Output is correct
22 Correct 17 ms 1856 KB Output is correct
23 Incorrect 22 ms 1880 KB Wrong Answer [2]
24 Halted 0 ms 0 KB -