Submission #943454

#TimeUsernameProblemLanguageResultExecution timeMemory
943454MinaRagy06Abracadabra (CEOI22_abracadabra)C++17
0 / 100
169 ms8532 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int a[1005][1005]; int main() { ios_base::sync_with_stdio(0), cin.tie(0); int n, q; cin >> n >> q; for (int i = 0; i < n; i++) { cin >> a[0][i]; } for (int j = 1; j <= n; j++) { int ptr1 = 0, ptr2 = n / 2; for (int i = 0; i < n; i++) { if (ptr1 == n / 2 || (ptr2 < n && a[j - 1][ptr2] < a[j - 1][ptr1])) { a[j][i] = a[j - 1][ptr2++]; } else { a[j][i] = a[j - 1][ptr1++]; } } } // for (int j = 0; j <= n; j++) { // for (int i = 0; i < n; i++) { // cout << a[j][i] << ' '; // } // cout << '\n'; // } while (q--) { int t, i; cin >> t >> i; t = min(t, 100); cout << a[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...