Submission #1019922

# Submission time Handle Problem Language Result Execution time Memory
1019922 2024-07-11T10:44:23 Z Abito Abracadabra (CEOI22_abracadabra) C++17
10 / 100
639 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<=2*n;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 Correct 184 ms 27728 KB Output is correct
2 Correct 147 ms 13624 KB Output is correct
3 Correct 144 ms 15188 KB Output is correct
4 Correct 143 ms 25172 KB Output is correct
5 Correct 153 ms 26960 KB Output is correct
6 Correct 178 ms 25076 KB Output is correct
7 Correct 170 ms 26964 KB Output is correct
8 Correct 142 ms 24916 KB Output is correct
9 Correct 139 ms 25936 KB Output is correct
10 Correct 147 ms 24768 KB Output is correct
11 Correct 155 ms 25936 KB Output is correct
12 Correct 140 ms 23980 KB Output is correct
13 Correct 148 ms 24660 KB Output is correct
14 Correct 156 ms 26312 KB Output is correct
15 Correct 142 ms 25680 KB Output is correct
16 Correct 12 ms 15960 KB Output is correct
17 Correct 125 ms 9724 KB Output is correct
18 Correct 145 ms 24400 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 612 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 639 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 184 ms 27728 KB Output is correct
2 Correct 147 ms 13624 KB Output is correct
3 Correct 144 ms 15188 KB Output is correct
4 Correct 143 ms 25172 KB Output is correct
5 Correct 153 ms 26960 KB Output is correct
6 Correct 178 ms 25076 KB Output is correct
7 Correct 170 ms 26964 KB Output is correct
8 Correct 142 ms 24916 KB Output is correct
9 Correct 139 ms 25936 KB Output is correct
10 Correct 147 ms 24768 KB Output is correct
11 Correct 155 ms 25936 KB Output is correct
12 Correct 140 ms 23980 KB Output is correct
13 Correct 148 ms 24660 KB Output is correct
14 Correct 156 ms 26312 KB Output is correct
15 Correct 142 ms 25680 KB Output is correct
16 Correct 12 ms 15960 KB Output is correct
17 Correct 125 ms 9724 KB Output is correct
18 Correct 145 ms 24400 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 612 ms 524288 KB Execution killed with signal 9
22 Halted 0 ms 0 KB -