Submission #994343

# Submission time Handle Problem Language Result Execution time Memory
994343 2024-06-07T12:30:20 Z biank Abracadabra (CEOI22_abracadabra) C++14
10 / 100
416 ms 524292 KB
#include <bits/stdc++.h>

using namespace std;

#define sz(x) int(x.size())
#define all(x) begin(x),end(x)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define forn(i,n) for(int i=0;i<int(n);i++)
#define dforsn(i,s,n) for(int i=int(n)-1;i>=int(s);i--)
#define dforn(i,n) for(int i=int(n)-1;i>=0;i--)
#define dbg(x) cerr<<#x<<": "<<x<<endl

#define pb push_back

typedef vector<int> vi;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    int n,q;
    cin>>n>>q;
    vector<vi> p(1,vi(n));
    forn(i,n) cin>>p[0][i];
    while(true){
        int i=0,j=n/2;
        vi v(n);
        forn(k,n){
            if(i<n/2&&(j>=n||p.back()[i]<p.back()[j])) v[k]=p.back()[i++];
            else v[k]=p.back()[j++];
        }
        if(v==p.back()) break;
        p.pb(v);
    }
    while(q--){
        int t,i;
        cin>>t>>i;
        --i,t=min(t,sz(p)-1);
        cout<<p[t][i]<<'\n';
    }
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 152 ms 15828 KB Output is correct
2 Correct 142 ms 12712 KB Output is correct
3 Correct 133 ms 13136 KB Output is correct
4 Correct 125 ms 10388 KB Output is correct
5 Correct 134 ms 12116 KB Output is correct
6 Correct 129 ms 10836 KB Output is correct
7 Correct 140 ms 12288 KB Output is correct
8 Correct 122 ms 10832 KB Output is correct
9 Correct 127 ms 10576 KB Output is correct
10 Correct 122 ms 10836 KB Output is correct
11 Correct 127 ms 10836 KB Output is correct
12 Correct 120 ms 9640 KB Output is correct
13 Correct 129 ms 10232 KB Output is correct
14 Correct 129 ms 11348 KB Output is correct
15 Correct 130 ms 10576 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 112 ms 9636 KB Output is correct
18 Correct 116 ms 9552 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 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 416 ms 524292 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 152 ms 15828 KB Output is correct
2 Correct 142 ms 12712 KB Output is correct
3 Correct 133 ms 13136 KB Output is correct
4 Correct 125 ms 10388 KB Output is correct
5 Correct 134 ms 12116 KB Output is correct
6 Correct 129 ms 10836 KB Output is correct
7 Correct 140 ms 12288 KB Output is correct
8 Correct 122 ms 10832 KB Output is correct
9 Correct 127 ms 10576 KB Output is correct
10 Correct 122 ms 10836 KB Output is correct
11 Correct 127 ms 10836 KB Output is correct
12 Correct 120 ms 9640 KB Output is correct
13 Correct 129 ms 10232 KB Output is correct
14 Correct 129 ms 11348 KB Output is correct
15 Correct 130 ms 10576 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 112 ms 9636 KB Output is correct
18 Correct 116 ms 9552 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 392 ms 524288 KB Execution killed with signal 9
22 Halted 0 ms 0 KB -