# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
847524 | 2023-09-09T19:09:49 Z | SUNWOOOOOOOO | Abracadabra (CEOI22_abracadabra) | C++17 | 768 ms | 524288 KB |
#include <bits/stdc++.h> using namespace std; vector <vector <int>> deck; int n, q; vector <int> next_deck(vector <int> cur) { int i = 0, j = 0; vector <int> A; while (i < n / 2 || j < n / 2){ if (i != n / 2 && (j == n / 2 || cur[i] < cur[j + n / 2])) {A.push_back(cur[i]); i++;} else {A.push_back(cur[j + n / 2]); j++;} } return A; } int main() { vector <int> v; scanf("%d %d", &n, &q); for (int i = 0, a; i < n; i++) { scanf("%d", &a); v.push_back(a); } deck.push_back(v); for (int i = 0; i < n; i++){ vector <int> v = next_deck(deck.back()); if (v == deck.back()) break; deck.push_back(v); } vector <int> ans; while (q--){ int t, i; scanf("%d %d", &t, &i); t = min(t, (int) deck.size() - 1); ans.push_back(deck[t][i - 1]); } for (int elm : ans) printf("%d\n", elm); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 210 ms | 20080 KB | Output is correct |
2 | Correct | 204 ms | 16744 KB | Output is correct |
3 | Correct | 199 ms | 17116 KB | Output is correct |
4 | Correct | 184 ms | 14016 KB | Output is correct |
5 | Correct | 202 ms | 15976 KB | Output is correct |
6 | Correct | 188 ms | 14796 KB | Output is correct |
7 | Correct | 212 ms | 16456 KB | Output is correct |
8 | Correct | 194 ms | 14668 KB | Output is correct |
9 | Correct | 186 ms | 14352 KB | Output is correct |
10 | Correct | 195 ms | 14796 KB | Output is correct |
11 | Correct | 185 ms | 14648 KB | Output is correct |
12 | Correct | 181 ms | 13608 KB | Output is correct |
13 | Correct | 188 ms | 14120 KB | Output is correct |
14 | Correct | 193 ms | 15304 KB | Output is correct |
15 | Correct | 195 ms | 14644 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 178 ms | 13756 KB | Output is correct |
18 | Correct | 181 ms | 13496 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 768 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 716 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 210 ms | 20080 KB | Output is correct |
2 | Correct | 204 ms | 16744 KB | Output is correct |
3 | Correct | 199 ms | 17116 KB | Output is correct |
4 | Correct | 184 ms | 14016 KB | Output is correct |
5 | Correct | 202 ms | 15976 KB | Output is correct |
6 | Correct | 188 ms | 14796 KB | Output is correct |
7 | Correct | 212 ms | 16456 KB | Output is correct |
8 | Correct | 194 ms | 14668 KB | Output is correct |
9 | Correct | 186 ms | 14352 KB | Output is correct |
10 | Correct | 195 ms | 14796 KB | Output is correct |
11 | Correct | 185 ms | 14648 KB | Output is correct |
12 | Correct | 181 ms | 13608 KB | Output is correct |
13 | Correct | 188 ms | 14120 KB | Output is correct |
14 | Correct | 193 ms | 15304 KB | Output is correct |
15 | Correct | 195 ms | 14644 KB | Output is correct |
16 | Correct | 1 ms | 348 KB | Output is correct |
17 | Correct | 178 ms | 13756 KB | Output is correct |
18 | Correct | 181 ms | 13496 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 0 ms | 344 KB | Output is correct |
21 | Runtime error | 768 ms | 524288 KB | Execution killed with signal 9 |
22 | Halted | 0 ms | 0 KB | - |