Submission #501625

# Submission time Handle Problem Language Result Execution time Memory
501625 2022-01-04T08:46:17 Z qwerasdfzxcl Minerals (JOI19_minerals) C++14
70 / 100
26 ms 2124 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++){
            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 1 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 7 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 1 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 7 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 892 KB Output is correct
13 Correct 7 ms 920 KB Output is correct
14 Correct 8 ms 968 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 1 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 7 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 892 KB Output is correct
13 Correct 7 ms 920 KB Output is correct
14 Correct 8 ms 968 KB Output is correct
15 Correct 26 ms 1996 KB Output is correct
16 Correct 21 ms 2044 KB Output is correct
17 Correct 18 ms 2124 KB Output is correct
18 Correct 23 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 1 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 7 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 892 KB Output is correct
13 Correct 7 ms 920 KB Output is correct
14 Correct 8 ms 968 KB Output is correct
15 Correct 26 ms 1996 KB Output is correct
16 Correct 21 ms 2044 KB Output is correct
17 Correct 18 ms 2124 KB Output is correct
18 Correct 23 ms 1900 KB Output is correct
19 Incorrect 20 ms 1872 KB Wrong Answer [2]
20 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 1 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 7 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 892 KB Output is correct
13 Correct 7 ms 920 KB Output is correct
14 Correct 8 ms 968 KB Output is correct
15 Correct 26 ms 1996 KB Output is correct
16 Correct 21 ms 2044 KB Output is correct
17 Correct 18 ms 2124 KB Output is correct
18 Correct 23 ms 1900 KB Output is correct
19 Incorrect 20 ms 1872 KB Wrong Answer [2]
20 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 1 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 7 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 892 KB Output is correct
13 Correct 7 ms 920 KB Output is correct
14 Correct 8 ms 968 KB Output is correct
15 Correct 26 ms 1996 KB Output is correct
16 Correct 21 ms 2044 KB Output is correct
17 Correct 18 ms 2124 KB Output is correct
18 Correct 23 ms 1900 KB Output is correct
19 Incorrect 20 ms 1872 KB Wrong Answer [2]
20 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 1 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 7 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 892 KB Output is correct
13 Correct 7 ms 920 KB Output is correct
14 Correct 8 ms 968 KB Output is correct
15 Correct 26 ms 1996 KB Output is correct
16 Correct 21 ms 2044 KB Output is correct
17 Correct 18 ms 2124 KB Output is correct
18 Correct 23 ms 1900 KB Output is correct
19 Incorrect 20 ms 1872 KB Wrong Answer [2]
20 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 1 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 7 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 892 KB Output is correct
13 Correct 7 ms 920 KB Output is correct
14 Correct 8 ms 968 KB Output is correct
15 Correct 26 ms 1996 KB Output is correct
16 Correct 21 ms 2044 KB Output is correct
17 Correct 18 ms 2124 KB Output is correct
18 Correct 23 ms 1900 KB Output is correct
19 Incorrect 20 ms 1872 KB Wrong Answer [2]
20 Halted 0 ms 0 KB -