답안 #1016192

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1016192 2024-07-07T13:34:55 Z irmuun Abracadabra (CEOI22_abracadabra) C++17
10 / 100
259 ms 524288 KB
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n,q;
    cin>>n>>q;
    int a[n+5];
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    int b[n+5][n+5],cur=0;
    for(int i=1;i<=n;i++){
        b[0][i]=a[i];
    }
    while(true){
        cur++;
        int l=1,r=n/2+1,i=0;
        while(l<=n/2||r<=n){
            if(l>n/2){
                b[cur][++i]=a[r++];
            }
            else if(r>n) {
                b[cur][++i]=a[l++];
            }
            else if(a[l]<a[r]) {
                b[cur][++i]=a[l++];
            }
            else{
                b[cur][++i]=a[r++];
            }
        }
        bool ok=true;
        for(int i=1;i<=n;i++){
            if(a[i]!=b[cur][i]) ok=false;
        }
        if(ok) break;
        for(int i=1;i<=n;i++){
            a[i]=b[cur][i];
        }
    }
    while(q--){
        int t,k;
        cin>>t>>k;
        t=min(t,cur);
        cout<<b[t][k]<<"\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 140 ms 15952 KB Output is correct
2 Correct 136 ms 15552 KB Output is correct
3 Correct 157 ms 15112 KB Output is correct
4 Correct 118 ms 13904 KB Output is correct
5 Correct 134 ms 15340 KB Output is correct
6 Correct 116 ms 14160 KB Output is correct
7 Correct 126 ms 15440 KB Output is correct
8 Correct 122 ms 14180 KB Output is correct
9 Correct 114 ms 14164 KB Output is correct
10 Correct 131 ms 14120 KB Output is correct
11 Correct 167 ms 14416 KB Output is correct
12 Correct 125 ms 13184 KB Output is correct
13 Correct 137 ms 13904 KB Output is correct
14 Correct 144 ms 14768 KB Output is correct
15 Correct 146 ms 14336 KB Output is correct
16 Correct 2 ms 4184 KB Output is correct
17 Correct 141 ms 13396 KB Output is correct
18 Correct 122 ms 13396 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 255 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 259 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 140 ms 15952 KB Output is correct
2 Correct 136 ms 15552 KB Output is correct
3 Correct 157 ms 15112 KB Output is correct
4 Correct 118 ms 13904 KB Output is correct
5 Correct 134 ms 15340 KB Output is correct
6 Correct 116 ms 14160 KB Output is correct
7 Correct 126 ms 15440 KB Output is correct
8 Correct 122 ms 14180 KB Output is correct
9 Correct 114 ms 14164 KB Output is correct
10 Correct 131 ms 14120 KB Output is correct
11 Correct 167 ms 14416 KB Output is correct
12 Correct 125 ms 13184 KB Output is correct
13 Correct 137 ms 13904 KB Output is correct
14 Correct 144 ms 14768 KB Output is correct
15 Correct 146 ms 14336 KB Output is correct
16 Correct 2 ms 4184 KB Output is correct
17 Correct 141 ms 13396 KB Output is correct
18 Correct 122 ms 13396 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Runtime error 255 ms 524288 KB Execution killed with signal 9
22 Halted 0 ms 0 KB -