답안 #1014600

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1014600 2024-07-05T07:48:54 Z vjudge1 Abracadabra (CEOI22_abracadabra) C++17
10 / 100
3000 ms 20052 KB
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,l,r) for(int i=l; i<r; i++)
#define all(x) x.begin(),x.end()
#define len(x) (int)x.size();
#define fi first
#define se second
#define elif else if
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
constexpr ll LINF=1001001001001001001LL;
constexpr ll MINF=1001001001001LL;
constexpr int INF=1001001001;

int N;
vi riffle(vi p){
    int lf=0;
    int ri=N/2;
    vi ret(N);
    rep(i,N){
        if(lf==N/2||(ri!=N&&p[lf]>p[ri])){
            ret[i]=p[ri];
            ri++;
        }
        else{
            ret[i]=p[lf];
            lf++;
        }
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int Q;
    cin>>N>>Q;
    vi P(N);
    rep(i,N)cin>>P[i];
    vector<vector<pii>> query(20000);
    rep(i,Q){
        int t,p;
        cin>>t>>p;
        query[min(19999,t)].emplace_back(i,p-1);
    }
    vi ans(Q);
    rep(i,20000){
        for(auto &[j,p]:query[i]){
            ans[j]=P[p];
        }
        P=riffle(P);
    }
    for(int i:ans)cout<<i<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 168 ms 18772 KB Output is correct
2 Correct 164 ms 17860 KB Output is correct
3 Correct 153 ms 17376 KB Output is correct
4 Correct 144 ms 17108 KB Output is correct
5 Correct 162 ms 19668 KB Output is correct
6 Correct 169 ms 20052 KB Output is correct
7 Correct 157 ms 20016 KB Output is correct
8 Correct 181 ms 18464 KB Output is correct
9 Correct 179 ms 17384 KB Output is correct
10 Correct 175 ms 17340 KB Output is correct
11 Correct 154 ms 17744 KB Output is correct
12 Correct 153 ms 15796 KB Output is correct
13 Correct 148 ms 16832 KB Output is correct
14 Correct 156 ms 18776 KB Output is correct
15 Correct 149 ms 17068 KB Output is correct
16 Correct 17 ms 860 KB Output is correct
17 Correct 133 ms 16056 KB Output is correct
18 Correct 141 ms 15956 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 1 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3032 ms 14820 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2396 ms 4044 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 168 ms 18772 KB Output is correct
2 Correct 164 ms 17860 KB Output is correct
3 Correct 153 ms 17376 KB Output is correct
4 Correct 144 ms 17108 KB Output is correct
5 Correct 162 ms 19668 KB Output is correct
6 Correct 169 ms 20052 KB Output is correct
7 Correct 157 ms 20016 KB Output is correct
8 Correct 181 ms 18464 KB Output is correct
9 Correct 179 ms 17384 KB Output is correct
10 Correct 175 ms 17340 KB Output is correct
11 Correct 154 ms 17744 KB Output is correct
12 Correct 153 ms 15796 KB Output is correct
13 Correct 148 ms 16832 KB Output is correct
14 Correct 156 ms 18776 KB Output is correct
15 Correct 149 ms 17068 KB Output is correct
16 Correct 17 ms 860 KB Output is correct
17 Correct 133 ms 16056 KB Output is correct
18 Correct 141 ms 15956 KB Output is correct
19 Correct 1 ms 860 KB Output is correct
20 Correct 1 ms 860 KB Output is correct
21 Execution timed out 3032 ms 14820 KB Time limit exceeded
22 Halted 0 ms 0 KB -