Submission #943452

# Submission time Handle Problem Language Result Execution time Memory
943452 2024-03-11T13:26:05 Z MinaRagy06 Abracadabra (CEOI22_abracadabra) C++17
10 / 100
174 ms 12364 KB
#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, n);
		cout << a[t][i - 1] << '\n';
	}
	return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 162 ms 12364 KB Output is correct
2 Correct 150 ms 11940 KB Output is correct
3 Correct 161 ms 11804 KB Output is correct
4 Correct 145 ms 11316 KB Output is correct
5 Correct 158 ms 11972 KB Output is correct
6 Correct 148 ms 11604 KB Output is correct
7 Correct 157 ms 11860 KB Output is correct
8 Correct 140 ms 11460 KB Output is correct
9 Correct 147 ms 11180 KB Output is correct
10 Correct 168 ms 11488 KB Output is correct
11 Correct 141 ms 11672 KB Output is correct
12 Correct 136 ms 10836 KB Output is correct
13 Correct 144 ms 11216 KB Output is correct
14 Correct 148 ms 11676 KB Output is correct
15 Correct 149 ms 11268 KB Output is correct
16 Correct 2 ms 4188 KB Output is correct
17 Correct 153 ms 10828 KB Output is correct
18 Correct 159 ms 10836 KB Output is correct
19 Correct 0 ms 600 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 174 ms 8576 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 116 ms 8592 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 162 ms 12364 KB Output is correct
2 Correct 150 ms 11940 KB Output is correct
3 Correct 161 ms 11804 KB Output is correct
4 Correct 145 ms 11316 KB Output is correct
5 Correct 158 ms 11972 KB Output is correct
6 Correct 148 ms 11604 KB Output is correct
7 Correct 157 ms 11860 KB Output is correct
8 Correct 140 ms 11460 KB Output is correct
9 Correct 147 ms 11180 KB Output is correct
10 Correct 168 ms 11488 KB Output is correct
11 Correct 141 ms 11672 KB Output is correct
12 Correct 136 ms 10836 KB Output is correct
13 Correct 144 ms 11216 KB Output is correct
14 Correct 148 ms 11676 KB Output is correct
15 Correct 149 ms 11268 KB Output is correct
16 Correct 2 ms 4188 KB Output is correct
17 Correct 153 ms 10828 KB Output is correct
18 Correct 159 ms 10836 KB Output is correct
19 Correct 0 ms 600 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Runtime error 174 ms 8576 KB Execution killed with signal 11
22 Halted 0 ms 0 KB -