Submission #1226145

#TimeUsernameProblemLanguageResultExecution timeMemory
1226145trideserAbracadabra (CEOI22_abracadabra)C++20
0 / 100
960 ms589824 KiB
#include <bits/stdc++.h> using namespace std; int main() { int N, Q; vector<vector<int>> vect; cin >> N; cin >> Q; vect.push_back(vector<int>(N)); for(int i = 0; i < N; i++) { cin >> vect[0][i]; } bool b = true; while(b) { vect.push_back(vector<int>(N)); int i1 = 0; int i2 = N / 2; int i = 0; while(i1 < N / 2 && i2 < N) { if(vect[vect.size() - 2][i1] < vect[vect.size() - 2][i2]) { vect[vect.size() - 1][i] = vect[vect.size() - 2][i1]; i1++; } else { vect[vect.size() - 1][i] = vect[vect.size() - 2][i2]; i2++; } i++; } while(i1 < N / 2) { vect[vect.size() - 1][i] = vect[vect.size() - 2][i1]; i1++; i++; } while(i2 < N) { vect[vect.size() - 1][i] = vect[vect.size() - 2][i2]; i2++; i++; } b = false; for(int j = 0; j < N; j++) { if(vect[vect.size() - 1][j] != vect[vect.size() - 2][j]) b = true; } } for(vector<int> v : vect) { for(int a : v) { //cerr << a << " "; } //cerr << "\n"; } for(int j = 0; j < Q; j++) { int t, i; cin >> t; cin >> i; if(t >= vect.size()) cout << vect[vect.size() - 1][i - 1]; else cout << vect[t][i - 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...