Submission #791390

# Submission time Handle Problem Language Result Execution time Memory
791390 2023-07-24T05:18:13 Z t6twotwo Abracadabra (CEOI22_abracadabra) C++17
0 / 100
790 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;
    set<vector<int>> S;
    do {
        T.push_back(A);
        S.insert(A);
        shuffle(A);
    } while (!S.count(A));
    int M = T.size();
    while (Q--) {
        int t, i;
        cin >> t >> i; i--;
        cout << T[t % M][i] << "\n";
    }
    return 6/22;
}
# Verdict Execution time Memory Grader output
1 Incorrect 185 ms 19904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 784 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 790 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 185 ms 19904 KB Output isn't correct
2 Halted 0 ms 0 KB -