Submission #943451

# Submission time Handle Problem Language Result Execution time Memory
943451 2024-03-11T13:25:29 Z MinaRagy06 Abracadabra (CEOI22_abracadabra) C++17
0 / 100
172 ms 12500 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;
		cout << a[t][i - 1] << '\n';
	}
	return 0;
}

# Verdict Execution time Memory Grader output
1 Runtime error 54 ms 12500 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 172 ms 9956 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 96 ms 8832 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 54 ms 12500 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -