# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1034961 | 2024-07-26T00:48:56 Z | pcc | Abracadabra (CEOI22_abracadabra) | C++17 | 821 ms | 524288 KB |
#include <bits/stdc++.h> using namespace std; #define pii pair<int,int> #define fs first #define sc second bool same(vector<int>&a,vector<int>&b){ assert(a.size() == b.size()); for(int i = 0;i<a.size();i++){ if(a[i] != b[i])return false; } return true; } vector<int> shuf(vector<int> &v){ vector<int> vl,vr; int pl = 0,pr = 0; for(int i = 0;i<v.size();i++){ if(i+i<v.size())vl.push_back(v[i]); else vr.push_back(v[i]); } vector<int> re; while(pl<vl.size()&&pr<vr.size()){ if(vl[pl]<vr[pr])re.push_back(vl[pl++]); else re.push_back(vr[pr++]); } while(pl<vl.size())re.push_back(vl[pl++]); while(pr<vr.size())re.push_back(vr[pr++]); return re; } int N,Q; vector<int> v; int epo; vector<vector<int>> all; int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>N>>Q; v.resize(N); for(int i = 0;i<N;i++)cin>>v[i]; epo = 0; all.push_back(v); while(!same(all.back(),v = shuf(all.back()))){ all.push_back(v); epo++; } while(Q--){ int t,id; cin>>t>>id; t = min(t+1,(int)all.size())-1; cout<<all[t][id-1]<<'\n'; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 143 ms | 15700 KB | Output is correct |
2 | Correct | 136 ms | 12620 KB | Output is correct |
3 | Correct | 135 ms | 13140 KB | Output is correct |
4 | Correct | 116 ms | 10344 KB | Output is correct |
5 | Correct | 139 ms | 12112 KB | Output is correct |
6 | Correct | 122 ms | 11032 KB | Output is correct |
7 | Correct | 169 ms | 12212 KB | Output is correct |
8 | Correct | 128 ms | 10904 KB | Output is correct |
9 | Correct | 123 ms | 10580 KB | Output is correct |
10 | Correct | 122 ms | 10836 KB | Output is correct |
11 | Correct | 140 ms | 10836 KB | Output is correct |
12 | Correct | 111 ms | 9628 KB | Output is correct |
13 | Correct | 120 ms | 10324 KB | Output is correct |
14 | Correct | 126 ms | 11368 KB | Output is correct |
15 | Correct | 124 ms | 10580 KB | Output is correct |
16 | Correct | 0 ms | 344 KB | Output is correct |
17 | Correct | 110 ms | 9652 KB | Output is correct |
18 | Correct | 116 ms | 9808 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 821 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 810 ms | 524288 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 143 ms | 15700 KB | Output is correct |
2 | Correct | 136 ms | 12620 KB | Output is correct |
3 | Correct | 135 ms | 13140 KB | Output is correct |
4 | Correct | 116 ms | 10344 KB | Output is correct |
5 | Correct | 139 ms | 12112 KB | Output is correct |
6 | Correct | 122 ms | 11032 KB | Output is correct |
7 | Correct | 169 ms | 12212 KB | Output is correct |
8 | Correct | 128 ms | 10904 KB | Output is correct |
9 | Correct | 123 ms | 10580 KB | Output is correct |
10 | Correct | 122 ms | 10836 KB | Output is correct |
11 | Correct | 140 ms | 10836 KB | Output is correct |
12 | Correct | 111 ms | 9628 KB | Output is correct |
13 | Correct | 120 ms | 10324 KB | Output is correct |
14 | Correct | 126 ms | 11368 KB | Output is correct |
15 | Correct | 124 ms | 10580 KB | Output is correct |
16 | Correct | 0 ms | 344 KB | Output is correct |
17 | Correct | 110 ms | 9652 KB | Output is correct |
18 | Correct | 116 ms | 9808 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Runtime error | 821 ms | 524288 KB | Execution killed with signal 9 |
22 | Halted | 0 ms | 0 KB | - |