Submission #366860

# Submission time Handle Problem Language Result Execution time Memory
366860 2021-02-15T13:14:41 Z kostia244 Archery (IOI09_archery) C++17
12 / 100
2000 ms 512 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 Correct 1 ms 364 KB Output is correct
2 Execution timed out 2074 ms 364 KB Time limit exceeded
3 Correct 238 ms 364 KB Output is correct
4 Execution timed out 2086 ms 364 KB Time limit exceeded
5 Correct 1 ms 364 KB Output is correct
6 Correct 1378 ms 396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 364 KB Output is correct
2 Execution timed out 2086 ms 364 KB Time limit exceeded
3 Execution timed out 2084 ms 364 KB Time limit exceeded
4 Runtime error 2 ms 492 KB Execution killed with signal 11
5 Runtime error 2 ms 492 KB Execution killed with signal 11
6 Execution timed out 2089 ms 364 KB Time limit exceeded
7 Execution timed out 2051 ms 512 KB Time limit exceeded
8 Runtime error 1 ms 492 KB Execution killed with signal 11
9 Runtime error 1 ms 492 KB Execution killed with signal 11
10 Execution timed out 2099 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 2 ms 492 KB Execution killed with signal 11
15 Runtime error 1 ms 492 KB Execution killed with signal 11
16 Correct 1150 ms 396 KB Output is correct
17 Incorrect 614 ms 404 KB Output isn't correct
18 Incorrect 781 ms 492 KB Output isn't correct
19 Execution timed out 2091 ms 364 KB Time limit exceeded
20 Runtime error 1 ms 492 KB Execution killed with signal 11
21 Runtime error 2 ms 492 KB Execution killed with signal 11
22 Runtime error 1 ms 492 KB Execution killed with signal 11
23 Runtime error 1 ms 492 KB Execution killed with signal 11
24 Execution timed out 2080 ms 364 KB Time limit exceeded
25 Execution timed out 2081 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 1 ms 492 KB Execution killed with signal 11
29 Incorrect 291 ms 408 KB Output isn't correct
30 Runtime error 2 ms 492 KB Execution killed with signal 11
31 Runtime error 2 ms 492 KB Execution killed with signal 11
32 Runtime error 1 ms 492 KB Execution killed with signal 11
33 Execution timed out 2070 ms 364 KB Time limit exceeded
34 Correct 1522 ms 492 KB Output is correct
35 Runtime error 1 ms 492 KB Execution killed with signal 11
36 Incorrect 1861 ms 492 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 Correct 1666 ms 492 KB Output is correct
40 Execution timed out 2073 ms 364 KB Time limit exceeded
41 Incorrect 22 ms 364 KB Output isn't correct
42 Runtime error 1 ms 492 KB Execution killed with signal 11
43 Runtime error 1 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 492 KB Execution killed with signal 11