| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 933597 | ezzzay | Abracadabra (CEOI22_abracadabra) | C++14 | 1463 ms | 524288 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
