Submission #709061

# Submission time Handle Problem Language Result Execution time Memory
709061 2023-03-13T05:29:51 Z vjudge1 Abracadabra (CEOI22_abracadabra) C++17
10 / 100
1931 ms 15440 KB
#include<bits/stdc++.h>

#define pb push_back
#define nl "\n"

using namespace std;

const int N = (int)2e5 + 7;
const int inf = (int)1e9 + 7;

int n, q, a[N];
int b[1001][1001];

int main() {
	ios_base::sync_with_stdio(NULL);
	cin.tie(0);
	cin >> n >> q;
	for(int i = 1; i <= n; ++i) {
		cin >> a[i];
		b[0][i] = a[i];	
	}
	for(int x = 1; x <= n; ++x) {
		vector<int> l, r, v;
		for(int i = 1; i <= n / 2; ++i) l.pb(b[x - 1][i]);
		for(int i = n / 2 + 1; i <= n; ++i) r.pb(b[x - 1][i]);
		int i1 = 0, i2 = 0;
		for(int i = 1; i <= n; ++i) {
			if(i1 < n / 2 && i2 < n / 2) {
				if(l[i1] < r[i2]) v.pb(l[i1++]);
				else v.pb(r[i2++]);			
			}
			if(i1 == n / 2) {
				v.pb(r[i2++]);
				continue;
			}
			if(i2 == n / 2) {
				v.pb(l[i1++]);
				continue;
			}
		}
		for(int i = 1; i <= n; ++i) b[x][i] = v[i - 1];
	}
	while(q--) {
		int i, x;
		cin >> x >> i;
		cout << b[min(n, x)][i] << nl;		
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 307 ms 8164 KB Output is correct
2 Correct 209 ms 15440 KB Output is correct
3 Correct 255 ms 15016 KB Output is correct
4 Correct 194 ms 14128 KB Output is correct
5 Correct 234 ms 15180 KB Output is correct
6 Correct 193 ms 14216 KB Output is correct
7 Correct 207 ms 15308 KB Output is correct
8 Correct 191 ms 14216 KB Output is correct
9 Correct 187 ms 14116 KB Output is correct
10 Correct 203 ms 14156 KB Output is correct
11 Correct 189 ms 14432 KB Output is correct
12 Correct 217 ms 13364 KB Output is correct
13 Correct 211 ms 13980 KB Output is correct
14 Correct 203 ms 14700 KB Output is correct
15 Correct 193 ms 14412 KB Output is correct
16 Correct 10 ms 4148 KB Output is correct
17 Correct 196 ms 13404 KB Output is correct
18 Correct 187 ms 13424 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 1931 ms 13076 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1042 ms 11368 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 307 ms 8164 KB Output is correct
2 Correct 209 ms 15440 KB Output is correct
3 Correct 255 ms 15016 KB Output is correct
4 Correct 194 ms 14128 KB Output is correct
5 Correct 234 ms 15180 KB Output is correct
6 Correct 193 ms 14216 KB Output is correct
7 Correct 207 ms 15308 KB Output is correct
8 Correct 191 ms 14216 KB Output is correct
9 Correct 187 ms 14116 KB Output is correct
10 Correct 203 ms 14156 KB Output is correct
11 Correct 189 ms 14432 KB Output is correct
12 Correct 217 ms 13364 KB Output is correct
13 Correct 211 ms 13980 KB Output is correct
14 Correct 203 ms 14700 KB Output is correct
15 Correct 193 ms 14412 KB Output is correct
16 Correct 10 ms 4148 KB Output is correct
17 Correct 196 ms 13404 KB Output is correct
18 Correct 187 ms 13424 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 1931 ms 13076 KB Execution killed with signal 11
22 Halted 0 ms 0 KB -