Submission #988962

# Submission time Handle Problem Language Result Execution time Memory
988962 2024-05-27T04:58:28 Z hmm789 Archery (IOI09_archery) C++14
22 / 100
2000 ms 9820 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long 

int32_t main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, r, x;
	cin >> n >> r >> x;
	r %= (2*n);
	int b[2*n-1];
	for(int i = 0; i < 2*n-1; i++) cin >> b[i];
	int a[2][2*n];
	bool flag = 0;
	int mn = n-1, ans = 0;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < 2*n; j++) a[0][j] = 0;
		a[0][2*i] = x;
		int idx = 0;
		for(int j = 0; j < 2*n; j++) if(!a[0][j]) {
			a[0][j] = b[idx++];
		}
		flag = 0;
		for(int j = 0; j < 2*n+r; j++) {
			for(int k = 1; k < n; k++) {
				a[flag^1][2*(k-1)] = min(a[flag][2*k], a[flag][2*k+1]);
				a[flag^1][2*k+1] = max(a[flag][2*k], a[flag][2*k+1]);
			}
			a[flag^1][2*n-2] = max(a[flag][0], a[flag][1]);
			a[flag^1][1] = min(a[flag][0], a[flag][1]);
			flag ^= 1;
		}
		for(int j = 0; j < 2*n; j++) if(a[flag][j] == x) {
			if(j/2 < mn) {
				mn = j/2;
				ans = i;
			} else if(j/2 == mn) {
				ans = max(ans, i);
			}
		}
	}
	cout << ans+1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 2089 ms 348 KB Time limit exceeded
3 Correct 4 ms 348 KB Output is correct
4 Execution timed out 2089 ms 348 KB Time limit exceeded
5 Correct 0 ms 344 KB Output is correct
6 Correct 15 ms 452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 20 ms 456 KB Output is correct
3 Execution timed out 2091 ms 348 KB Time limit exceeded
4 Execution timed out 2066 ms 1116 KB Time limit exceeded
5 Execution timed out 2061 ms 8232 KB Time limit exceeded
6 Correct 16 ms 348 KB Output is correct
7 Correct 1391 ms 596 KB Output is correct
8 Execution timed out 2059 ms 1116 KB Time limit exceeded
9 Execution timed out 2037 ms 1368 KB Time limit exceeded
10 Execution timed out 2054 ms 344 KB Time limit exceeded
11 Execution timed out 2005 ms 1368 KB Time limit exceeded
12 Execution timed out 2053 ms 348 KB Time limit exceeded
13 Execution timed out 2049 ms 6232 KB Time limit exceeded
14 Execution timed out 2093 ms 600 KB Time limit exceeded
15 Execution timed out 2029 ms 1880 KB Time limit exceeded
16 Correct 19 ms 344 KB Output is correct
17 Execution timed out 2073 ms 348 KB Time limit exceeded
18 Execution timed out 2021 ms 344 KB Time limit exceeded
19 Execution timed out 2033 ms 856 KB Time limit exceeded
20 Execution timed out 2070 ms 604 KB Time limit exceeded
21 Execution timed out 2013 ms 1372 KB Time limit exceeded
22 Execution timed out 2021 ms 1624 KB Time limit exceeded
23 Execution timed out 2070 ms 8796 KB Time limit exceeded
24 Correct 19 ms 600 KB Output is correct
25 Execution timed out 2037 ms 344 KB Time limit exceeded
26 Execution timed out 2005 ms 600 KB Time limit exceeded
27 Execution timed out 2021 ms 1372 KB Time limit exceeded
28 Execution timed out 2073 ms 6232 KB Time limit exceeded
29 Execution timed out 2060 ms 344 KB Time limit exceeded
30 Execution timed out 2064 ms 604 KB Time limit exceeded
31 Execution timed out 2051 ms 1368 KB Time limit exceeded
32 Execution timed out 2100 ms 8528 KB Time limit exceeded
33 Correct 26 ms 600 KB Output is correct
34 Correct 17 ms 348 KB Output is correct
35 Execution timed out 2066 ms 348 KB Time limit exceeded
36 Execution timed out 2067 ms 348 KB Time limit exceeded
37 Execution timed out 2053 ms 1116 KB Time limit exceeded
38 Execution timed out 2101 ms 1368 KB Time limit exceeded
39 Correct 22 ms 344 KB Output is correct
40 Execution timed out 2073 ms 348 KB Time limit exceeded
41 Execution timed out 2062 ms 348 KB Time limit exceeded
42 Execution timed out 2028 ms 348 KB Time limit exceeded
43 Execution timed out 2074 ms 604 KB Time limit exceeded
44 Execution timed out 2067 ms 860 KB Time limit exceeded
45 Execution timed out 2093 ms 1368 KB Time limit exceeded
46 Execution timed out 2072 ms 1368 KB Time limit exceeded
47 Execution timed out 2043 ms 9820 KB Time limit exceeded