Submission #791391

# Submission time Handle Problem Language Result Execution time Memory
791391 2023-07-24T05:21:24 Z t6twotwo Abracadabra (CEOI22_abracadabra) C++17
10 / 100
392 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void shuffle(vector<int> &a) {
    int n = a.size();
    vector<int> b;
    int j = n / 2;
    for (int i = 0; i < n / 2; i++) {
        while (j < n && a[j] < a[i]) {
            b.push_back(a[j++]);
        }
        b.push_back(a[i]);
    }
    for (int i = j; i < n; i++) {
        b.push_back(a[i]);
    }
    swap(a, b);
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, Q;
    cin >> N >> Q;
    vector<int> A(N);
    for (int &x : A) {
        cin >> x;
    }
    vector<vector<int>> T;
    do {
        T.push_back(A);
        shuffle(A);
    } while (A != T.back());
    int M = T.size();
    while (Q--) {
        int t, i;
        cin >> t >> i;
        t = min(t, M - 1);
        i--;
        cout << T[t][i] << "\n";
    }
    return 6/22;
}
# Verdict Execution time Memory Grader output
1 Correct 175 ms 9228 KB Output is correct
2 Correct 159 ms 12564 KB Output is correct
3 Correct 153 ms 13148 KB Output is correct
4 Correct 143 ms 10196 KB Output is correct
5 Correct 156 ms 11944 KB Output is correct
6 Correct 143 ms 10824 KB Output is correct
7 Correct 165 ms 12172 KB Output is correct
8 Correct 152 ms 10908 KB Output is correct
9 Correct 159 ms 10444 KB Output is correct
10 Correct 145 ms 10676 KB Output is correct
11 Correct 143 ms 10676 KB Output is correct
12 Correct 155 ms 9616 KB Output is correct
13 Correct 147 ms 10564 KB Output is correct
14 Correct 147 ms 11300 KB Output is correct
15 Correct 154 ms 10556 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 140 ms 9680 KB Output is correct
18 Correct 144 ms 9588 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 392 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 360 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 175 ms 9228 KB Output is correct
2 Correct 159 ms 12564 KB Output is correct
3 Correct 153 ms 13148 KB Output is correct
4 Correct 143 ms 10196 KB Output is correct
5 Correct 156 ms 11944 KB Output is correct
6 Correct 143 ms 10824 KB Output is correct
7 Correct 165 ms 12172 KB Output is correct
8 Correct 152 ms 10908 KB Output is correct
9 Correct 159 ms 10444 KB Output is correct
10 Correct 145 ms 10676 KB Output is correct
11 Correct 143 ms 10676 KB Output is correct
12 Correct 155 ms 9616 KB Output is correct
13 Correct 147 ms 10564 KB Output is correct
14 Correct 147 ms 11300 KB Output is correct
15 Correct 154 ms 10556 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 140 ms 9680 KB Output is correct
18 Correct 144 ms 9588 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 320 KB Output is correct
21 Runtime error 392 ms 524288 KB Execution killed with signal 9
22 Halted 0 ms 0 KB -