| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 772660 | doowey | Abracadabra (CEOI22_abracadabra) | C++14 | 3062 ms | 39884 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N = (int)2e5 + 10;
void shuffle(vector<int> &P){
queue<int> A, B;
for(int i = 0 ; i < P.size(); i ++ ){
if(i < P.size() / 2) A.push(P[i]);
else B.push(P[i]);
}
vector<int> nex;
while(!A.empty() || !B.empty()){
if(A.empty()){
nex.push_back(B.front());
B.pop();
}
else if(B.empty()){
nex.push_back(A.front());
A.pop();
}
else {
if(A.front() < B.front()){
nex.push_back(A.front());
A.pop();
}
else{
nex.push_back(B.front());
B.pop();
}
}
}
swap(P, nex);
}
vector<pii> qq[N]; // {index, idx}
int res[N];
int main(){
fastIO;
//freopen("in.txt", "r", stdin);
int n, q;
cin >> n >> q;
vector<int> P(n);
for(int i = 0 ; i < n; i ++ ){
cin >> P[i];
}
int t, id;
for(int iq = 1; iq <= q; iq ++ ){
cin >> t >> id;
t=min(t,n);
qq[t].push_back(mp(id, iq));
}
for(int i = 0 ; i <= n; i ++ ){
if(i) shuffle(P);
for(auto x : qq[i]){
res[x.se] = P[x.fi-1];
}
}
for(int iq = 1; iq <= q; iq ++ ){
cout << res[iq] << "\n";
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
