# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1095689 | 2024-10-03T01:21:50 Z | Sharky | Abracadabra (CEOI22_abracadabra) | C++17 | 766 ms | 524288 KB |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, q; cin >> n >> q; vector<int> a(n); for (auto& x : a) cin >> x; vector<vector<int>> h; h.push_back(a); for (int i = 0; i < n; i++) { vector<int> x, y, res; for (int j = 0; j < n / 2; j++) x.push_back(a[j]); for (int j = n / 2; j < n; j++) y.push_back(a[j]); int px = 0, py = 0; while (px < n / 2 || py < n / 2) { if (px == n / 2) res.push_back(y[py++]); else if (py == n / 2) res.push_back(x[px++]); else if (x[px] < y[py]) res.push_back(x[px++]); else res.push_back(y[py++]); } bool chg = 0; for (int j = 0; j < n; j++) if (res[j] != a[j]) chg = true; if (!chg) break; h.push_back(res); a.swap(res); } while (q--) { int t, id; cin >> t >> id; --id; if (t >= h.size()) cout << h.back()[id] << '\n'; else cout << h[t][id] << '\n'; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 150 ms | 15956 KB | Output is correct |
2 | Correct | 147 ms | 12612 KB | Output is correct |
3 | Correct | 143 ms | 13140 KB | Output is correct |
4 | Correct | 124 ms | 10320 KB | Output is correct |
5 | Correct | 143 ms | 12112 KB | Output is correct |
6 | Correct | 136 ms | 10792 KB | Output is correct |
7 | Correct | 140 ms | 12112 KB | Output is correct |
8 | Correct | 130 ms | 10832 KB | Output is correct |
9 | Correct | 122 ms | 10624 KB | Output is correct |
10 | Correct | 137 ms | 10884 KB | Output is correct |
11 | Correct | 126 ms | 10836 KB | Output is correct |
12 | Correct | 116 ms | 9556 KB | Output is correct |
13 | Correct | 133 ms | 10512 KB | Output is correct |
14 | Correct | 131 ms | 11344 KB | Output is correct |
15 | Correct | 136 ms | 10640 KB | Output is correct |
16 | Correct | 1 ms | 344 KB | Output is correct |
17 | Correct | 118 ms | 9788 KB | Output is correct |
18 | Correct | 130 ms | 9772 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 766 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 758 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 150 ms | 15956 KB | Output is correct |
2 | Correct | 147 ms | 12612 KB | Output is correct |
3 | Correct | 143 ms | 13140 KB | Output is correct |
4 | Correct | 124 ms | 10320 KB | Output is correct |
5 | Correct | 143 ms | 12112 KB | Output is correct |
6 | Correct | 136 ms | 10792 KB | Output is correct |
7 | Correct | 140 ms | 12112 KB | Output is correct |
8 | Correct | 130 ms | 10832 KB | Output is correct |
9 | Correct | 122 ms | 10624 KB | Output is correct |
10 | Correct | 137 ms | 10884 KB | Output is correct |
11 | Correct | 126 ms | 10836 KB | Output is correct |
12 | Correct | 116 ms | 9556 KB | Output is correct |
13 | Correct | 133 ms | 10512 KB | Output is correct |
14 | Correct | 131 ms | 11344 KB | Output is correct |
15 | Correct | 136 ms | 10640 KB | Output is correct |
16 | Correct | 1 ms | 344 KB | Output is correct |
17 | Correct | 118 ms | 9788 KB | Output is correct |
18 | Correct | 130 ms | 9772 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Runtime error | 766 ms | 524288 KB | Execution killed with signal 9 |
22 | Halted | 0 ms | 0 KB | - |