Submission #933597

# Submission time Handle Problem Language Result Execution time Memory
933597 2024-02-26T01:02:58 Z ezzzay Abracadabra (CEOI22_abracadabra) C++14
10 / 100
1463 ms 524288 KB
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
const int N=1e4;
int n,q;
vector<vector<int>>v;
map<int,vector<int>>mp;
vector<int>ans;
signed main(){
    cin>>n>>q;
    vector<int>vc;
    for(int i=1;i<=n;i++){
        int a;
        cin>>a;
        vc.pb(a);
    }
    mp[0]=vc;
    int y=0;
    for(int l=1;l<=n;l++){
        vc=mp[l-1];
        vector<int>vec;
        int i = 0, j = n/2;
        while(i<n/2 and j<n){
            if(vc[i]<vc[j]){
                vec.pb(vc[i++]);
            }
            else{
                vec.pb(vc[j++]);
            }
        }
        while(i<n/2){
            vec.pb(vc[i++]);
        }
        while(j<n)vec.pb(vc[j++]);
        
        mp[l]=vec;
        y=l;
        if(mp[l]==mp[l-1])break;
        
    }
    while(q--){
        int t,idx;
        cin>>t>>idx;
        idx--;
        if(t>y)t=y;
        ans.pb(mp[t][idx]);
    }
    for(auto a:ans)cout<<a<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1463 ms 20204 KB Output is correct
2 Correct 1448 ms 16804 KB Output is correct
3 Correct 1389 ms 17152 KB Output is correct
4 Correct 1337 ms 14616 KB Output is correct
5 Correct 1419 ms 16480 KB Output is correct
6 Correct 1403 ms 14952 KB Output is correct
7 Correct 1430 ms 16476 KB Output is correct
8 Correct 1363 ms 15020 KB Output is correct
9 Correct 1338 ms 14628 KB Output is correct
10 Correct 1354 ms 15088 KB Output is correct
11 Correct 1365 ms 14776 KB Output is correct
12 Correct 1314 ms 13696 KB Output is correct
13 Correct 1365 ms 14368 KB Output is correct
14 Correct 1394 ms 15784 KB Output is correct
15 Correct 1405 ms 14752 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1323 ms 13628 KB Output is correct
18 Correct 1305 ms 13808 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 653 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 492 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1463 ms 20204 KB Output is correct
2 Correct 1448 ms 16804 KB Output is correct
3 Correct 1389 ms 17152 KB Output is correct
4 Correct 1337 ms 14616 KB Output is correct
5 Correct 1419 ms 16480 KB Output is correct
6 Correct 1403 ms 14952 KB Output is correct
7 Correct 1430 ms 16476 KB Output is correct
8 Correct 1363 ms 15020 KB Output is correct
9 Correct 1338 ms 14628 KB Output is correct
10 Correct 1354 ms 15088 KB Output is correct
11 Correct 1365 ms 14776 KB Output is correct
12 Correct 1314 ms 13696 KB Output is correct
13 Correct 1365 ms 14368 KB Output is correct
14 Correct 1394 ms 15784 KB Output is correct
15 Correct 1405 ms 14752 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1323 ms 13628 KB Output is correct
18 Correct 1305 ms 13808 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 653 ms 524288 KB Execution killed with signal 9
22 Halted 0 ms 0 KB -