# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
795455 | 2023-07-27T09:58:02 Z | SlavicG | Minerals (JOI19_minerals) | C++17 | 13 ms | 1744 KB |
#include <bits/stdc++.h> #include "minerals.h" using namespace std; void Solve(int n) { vector<int> p1, p2; int ans = 0, prevans = -1; for(int i = 1; i <= 2 * n; ++i) { ans = Query(i); if(ans == prevans) { p2.push_back(i); Query(i); } else { p1.push_back(i); } prevans = ans; } assert(p1.size() == n && p2.size() == n); vector<int> pr(n, 0); for(int bit = 0; (1 << bit) < n; ++bit) { for(int i = 0; i < n; ++i) { if(i >> bit & 1) continue; prevans = Query(p1[i]); } for(int i = 0; i < n; ++i) { int ans = Query(p2[i]); if(ans == prevans) { pr[i] += (1 << bit); } Query(p2[i]); } for(int i = 0; i < n; ++i) { if(i >> bit & 1) continue; prevans = Query(p1[i]); } } for(int i = 0; i < n; ++i) { Answer(p2[i], p1[pr[i]]); } } /* 4 1 5 2 6 3 4 7 8 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 2 ms | 464 KB | Output is correct |
4 | Correct | 3 ms | 592 KB | Output is correct |
5 | Correct | 7 ms | 792 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 2 ms | 464 KB | Output is correct |
8 | Correct | 3 ms | 592 KB | Output is correct |
9 | Correct | 7 ms | 792 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 6 ms | 764 KB | Output is correct |
12 | Correct | 9 ms | 848 KB | Output is correct |
13 | Correct | 5 ms | 976 KB | Output is correct |
14 | Correct | 5 ms | 856 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 2 ms | 464 KB | Output is correct |
8 | Correct | 3 ms | 592 KB | Output is correct |
9 | Correct | 7 ms | 792 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 6 ms | 764 KB | Output is correct |
12 | Correct | 9 ms | 848 KB | Output is correct |
13 | Correct | 5 ms | 976 KB | Output is correct |
14 | Correct | 5 ms | 856 KB | Output is correct |
15 | Incorrect | 13 ms | 1744 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 2 ms | 464 KB | Output is correct |
8 | Correct | 3 ms | 592 KB | Output is correct |
9 | Correct | 7 ms | 792 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 6 ms | 764 KB | Output is correct |
12 | Correct | 9 ms | 848 KB | Output is correct |
13 | Correct | 5 ms | 976 KB | Output is correct |
14 | Correct | 5 ms | 856 KB | Output is correct |
15 | Incorrect | 13 ms | 1744 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 2 ms | 464 KB | Output is correct |
8 | Correct | 3 ms | 592 KB | Output is correct |
9 | Correct | 7 ms | 792 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 6 ms | 764 KB | Output is correct |
12 | Correct | 9 ms | 848 KB | Output is correct |
13 | Correct | 5 ms | 976 KB | Output is correct |
14 | Correct | 5 ms | 856 KB | Output is correct |
15 | Incorrect | 13 ms | 1744 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 2 ms | 464 KB | Output is correct |
8 | Correct | 3 ms | 592 KB | Output is correct |
9 | Correct | 7 ms | 792 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 6 ms | 764 KB | Output is correct |
12 | Correct | 9 ms | 848 KB | Output is correct |
13 | Correct | 5 ms | 976 KB | Output is correct |
14 | Correct | 5 ms | 856 KB | Output is correct |
15 | Incorrect | 13 ms | 1744 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 2 ms | 464 KB | Output is correct |
8 | Correct | 3 ms | 592 KB | Output is correct |
9 | Correct | 7 ms | 792 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 6 ms | 764 KB | Output is correct |
12 | Correct | 9 ms | 848 KB | Output is correct |
13 | Correct | 5 ms | 976 KB | Output is correct |
14 | Correct | 5 ms | 856 KB | Output is correct |
15 | Incorrect | 13 ms | 1744 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 2 ms | 464 KB | Output is correct |
8 | Correct | 3 ms | 592 KB | Output is correct |
9 | Correct | 7 ms | 792 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 6 ms | 764 KB | Output is correct |
12 | Correct | 9 ms | 848 KB | Output is correct |
13 | Correct | 5 ms | 976 KB | Output is correct |
14 | Correct | 5 ms | 856 KB | Output is correct |
15 | Incorrect | 13 ms | 1744 KB | Wrong Answer [2] |
16 | Halted | 0 ms | 0 KB | - |