Submission #1019937

# Submission time Handle Problem Language Result Execution time Memory
1019937 2024-07-11T10:54:01 Z Abito Abracadabra (CEOI22_abracadabra) C++17
0 / 100
675 ms 524288 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define ll long long
typedef unsigned long long ull;
using namespace std;
int n,q;
vector<vector<int>> v;
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin>>n>>q;
    v.pb({});
    v[0].resize(n);
    for (int i=0;i<n;i++) cin>>v[0][i];
    for (int k=1;k<=500;k++){
        vector<int> b;
        int i=0,j=n/2;
        while (i<n/2 && j<n){
            if (v.back()[i]<v.back()[j]) b.pb(v.back()[i++]);
            else b.pb(v.back()[j++]);
        }
        while (i<n/2) b.pb(v.back()[i++]);
        while (j<n) b.pb(v.back()[j++]);
        v.pb(b);
        bool ok=true;
        for (int i=0;i<n/2;i++) ok&=(b[i]==i+1);
        if (ok) break;
    }
    while (q--){
        int t,i;
        cin>>t>>i;
        t=min(t,(int)v.size()-1);
        cout<<v[t][i-1]<<endl;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 145 ms 12368 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 675 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 504 ms 395232 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 145 ms 12368 KB Output isn't correct
2 Halted 0 ms 0 KB -