Submission #643130

# Submission time Handle Problem Language Result Execution time Memory
643130 2022-09-21T09:14:27 Z elif Abracadabra (CEOI22_abracadabra) C++17
10 / 100
1475 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;
#define N 1003
int main(){

	ios_base::sync_with_stdio(0);

	int n, q;
	cin >> n >> q;
	vector<int> a(n);
	for(int i=0; i<n; i++)
		cin >> a[i];
	
	map<int, vector<int>> mp;
	
		mp[0] = a;

	for(int cnt=1; cnt<N; cnt++){
		int i = 0;
		int j = n/2;
		vector<int> v = a;
		int k = 0;
		while(i < n/2 && j < n){
			if(v[i] < v[j]){
				a[k] = v[i];
				k++, i++;
			}
			else{
				a[k] = v[j];
				k++, j++;
			}
		}
		while(i < n/2){
			a[k] = v[i];
			k++, i++;
		}
		while(j < n/2){
			a[k] = v[j];
			k++, j++;
		}
	
	/*	cout << "ARRAY:" << endl;
		for(auto x : a)
			cout << x << " ";
		cout << endl;
		cout << endl;

*/
		mp[cnt] = a;

	}

	for(int i=0; i<q; i++){
		int t, ind;
		cin >> t >> ind;
		if(t >= N)
			t = N-5;
		// cout << i << "th test: ";
		cout << mp[t][ind-1] << endl;
	}


	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1475 ms 9472 KB Output is correct
2 Correct 1419 ms 11800 KB Output is correct
3 Correct 1328 ms 11480 KB Output is correct
4 Correct 1289 ms 14084 KB Output is correct
5 Correct 1398 ms 13916 KB Output is correct
6 Correct 1324 ms 13456 KB Output is correct
7 Correct 1374 ms 12852 KB Output is correct
8 Correct 1300 ms 12600 KB Output is correct
9 Correct 1299 ms 13200 KB Output is correct
10 Correct 1306 ms 12748 KB Output is correct
11 Correct 1437 ms 12764 KB Output is correct
12 Correct 1310 ms 12240 KB Output is correct
13 Correct 1338 ms 12220 KB Output is correct
14 Correct 1340 ms 14600 KB Output is correct
15 Correct 1382 ms 14248 KB Output is correct
16 Correct 5 ms 4308 KB Output is correct
17 Correct 1301 ms 13260 KB Output is correct
18 Correct 1295 ms 13300 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 375 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 428 ms 396028 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1475 ms 9472 KB Output is correct
2 Correct 1419 ms 11800 KB Output is correct
3 Correct 1328 ms 11480 KB Output is correct
4 Correct 1289 ms 14084 KB Output is correct
5 Correct 1398 ms 13916 KB Output is correct
6 Correct 1324 ms 13456 KB Output is correct
7 Correct 1374 ms 12852 KB Output is correct
8 Correct 1300 ms 12600 KB Output is correct
9 Correct 1299 ms 13200 KB Output is correct
10 Correct 1306 ms 12748 KB Output is correct
11 Correct 1437 ms 12764 KB Output is correct
12 Correct 1310 ms 12240 KB Output is correct
13 Correct 1338 ms 12220 KB Output is correct
14 Correct 1340 ms 14600 KB Output is correct
15 Correct 1382 ms 14248 KB Output is correct
16 Correct 5 ms 4308 KB Output is correct
17 Correct 1301 ms 13260 KB Output is correct
18 Correct 1295 ms 13300 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Runtime error 375 ms 524288 KB Execution killed with signal 9
22 Halted 0 ms 0 KB -