Submission #366859

# Submission time Handle Problem Language Result Execution time Memory
366859 2021-02-15T13:13:29 Z kostia244 Archery (IOI09_archery) C++17
5 / 100
2000 ms 748 KB
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) begin(x), end(x)
const int maxn = 2020;
int n, r, p = 0, a[maxn], cur[maxn], sp = 0;
array<int, 2> ans = {100000, -1};
void check() {
	for(int i = 0; i < n; i++) cur[i] = a[i];
	//for(int i = 0; i < n; i++) cout << cur[i] << " "; cout << endl;
	for(int it = 0; it < r; it++) {
		for(int i = 1; i < n; i += 2)
			if(cur[i] < cur[i-1]) swap(cur[i], cur[i-1]);
		for(int i = 2; i < n; i++) swap(cur[i], cur[i-1]);
	}
	int pos = 0;
	while(cur[pos]) pos++;
	ans = min(ans, {pos, sp});
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n >> r;
	n *= 2;
	//r = r%(2*n);
	//r += 2*n;
	cin >> p;
	for(int i = 1; i < n; i++) {
		cin >> a[i];
	}
	for(int i = 1; i < n; i++) {
		a[i] = a[i] < p ? -1 : 1;
	}
	check();
	for(int i = 1; i < n; i++) {
		swap(a[i], a[i-1]);
		sp++;
		check();
	}
	cout << 1 + (ans[1]/2) << '\n';
} 
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Execution timed out 2066 ms 364 KB Time limit exceeded
3 Execution timed out 2062 ms 364 KB Time limit exceeded
4 Execution timed out 2065 ms 364 KB Time limit exceeded
5 Correct 4 ms 364 KB Output is correct
6 Execution timed out 2074 ms 364 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 27 ms 364 KB Output is correct
2 Execution timed out 2062 ms 492 KB Time limit exceeded
3 Execution timed out 2078 ms 364 KB Time limit exceeded
4 Runtime error 1 ms 492 KB Execution killed with signal 11
5 Runtime error 1 ms 620 KB Execution killed with signal 11
6 Execution timed out 2086 ms 364 KB Time limit exceeded
7 Execution timed out 2076 ms 364 KB Time limit exceeded
8 Runtime error 1 ms 492 KB Execution killed with signal 11
9 Runtime error 1 ms 748 KB Execution killed with signal 11
10 Execution timed out 2066 ms 364 KB Time limit exceeded
11 Runtime error 1 ms 492 KB Execution killed with signal 11
12 Runtime error 1 ms 492 KB Execution killed with signal 11
13 Runtime error 1 ms 492 KB Execution killed with signal 11
14 Runtime error 1 ms 492 KB Execution killed with signal 11
15 Runtime error 2 ms 608 KB Execution killed with signal 11
16 Incorrect 1135 ms 492 KB Output isn't correct
17 Incorrect 622 ms 492 KB Output isn't correct
18 Incorrect 762 ms 492 KB Output isn't correct
19 Execution timed out 2070 ms 364 KB Time limit exceeded
20 Runtime error 1 ms 492 KB Execution killed with signal 11
21 Runtime error 1 ms 492 KB Execution killed with signal 11
22 Runtime error 1 ms 492 KB Execution killed with signal 11
23 Runtime error 2 ms 492 KB Execution killed with signal 11
24 Incorrect 829 ms 492 KB Output isn't correct
25 Execution timed out 2077 ms 364 KB Time limit exceeded
26 Runtime error 1 ms 492 KB Execution killed with signal 11
27 Runtime error 1 ms 492 KB Execution killed with signal 11
28 Runtime error 2 ms 620 KB Execution killed with signal 11
29 Incorrect 292 ms 364 KB Output isn't correct
30 Runtime error 1 ms 492 KB Execution killed with signal 11
31 Runtime error 1 ms 492 KB Execution killed with signal 11
32 Runtime error 1 ms 620 KB Execution killed with signal 11
33 Correct 1127 ms 492 KB Output is correct
34 Execution timed out 2082 ms 364 KB Time limit exceeded
35 Runtime error 1 ms 492 KB Execution killed with signal 11
36 Incorrect 1882 ms 432 KB Output isn't correct
37 Runtime error 1 ms 492 KB Execution killed with signal 11
38 Runtime error 1 ms 492 KB Execution killed with signal 11
39 Execution timed out 2081 ms 364 KB Time limit exceeded
40 Execution timed out 2086 ms 364 KB Time limit exceeded
41 Incorrect 22 ms 364 KB Output isn't correct
42 Runtime error 2 ms 492 KB Execution killed with signal 11
43 Runtime error 2 ms 492 KB Execution killed with signal 11
44 Runtime error 1 ms 492 KB Execution killed with signal 11
45 Runtime error 1 ms 492 KB Execution killed with signal 11
46 Runtime error 1 ms 492 KB Execution killed with signal 11
47 Runtime error 1 ms 620 KB Execution killed with signal 11