제출 #1189364

#제출 시각아이디문제언어결과실행 시간메모리
1189364UnforgettableplAbracadabra (CEOI22_abracadabra)C++20
10 / 100
628 ms589824 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,Q; cin >> N >> Q; int MAX_ROUNDS = N; vector<vector<int>> round(MAX_ROUNDS+1); for(int i=1;i<=N;i++){ int x;cin>>x; round[0].emplace_back(x); } for(int r=1;r<=MAX_ROUNDS;r++){ int left = 0; int right = N/2; while(left<N/2 and right<N){ if(round[r-1][left]<round[r-1][right]){ round[r].emplace_back(round[r-1][left++]); } else { round[r].emplace_back(round[r-1][right++]); } } while(left<N/2){ round[r].emplace_back(round[r-1][left++]); } while(right<N){ round[r].emplace_back(round[r-1][right++]); } } for(int i=1;i<=Q;i++){ int t,x;cin>>t>>x; t = min(t,MAX_ROUNDS); cout << round[t][x-1] << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...