#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 time |
Memory |
Grader output |
1 |
Incorrect |
146 ms |
8080 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
169 ms |
8412 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
91 ms |
8532 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
146 ms |
8080 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |