Submission #848715

#TimeUsernameProblemLanguageResultExecution timeMemory
848715JoksimKaktusAbracadabra (CEOI22_abracadabra)C++17
0 / 100
3048 ms5456 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); int n,q; cin >> n >> q; vector <int> v(n); vector <int> res(n); for(int i = 0;i < n;i++){ cin >> v[i]; } for(int k = 0;k < q;k++){ int a,b; cin >> a >> b; if(k == 0){ int num = 0; while(num < a){ vector<int> v1(n/2); vector<int> v2(n/2); for(int i = 0;i < n/2;i++){ v1[i] = v[i]; v2[i] = v[i+n/2]; } int ind1 = 0; int ind2 = 0; while(ind1 < n/2 && ind2 < n/2){ if(v1[ind1] < v2[ind2]){ v[ind1+ind2] = v1[ind1]; ind1++; }else{ v[ind1+ind2] = v2[ind2]; ind2++; } } if(ind1 < n/2){ for(int j = ind1;j < n/2;j++){ v[j+ind2] = v1[j]; } }else{ for(int j = ind2;j < n/2;j++){ v[j+ind1] = v2[j]; } } num++; } for(int j = 0;j < n;j++){ res[j] = v[j]; } } cout << res[b-1] << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...