Submission #366863

# Submission time Handle Problem Language Result Execution time Memory
366863 2021-02-15T13:18:59 Z kostia244 Archery (IOI09_archery) C++17
12 / 100
2000 ms 528 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 = 404;
int n, r, p = 0, a[maxn], sp = 0;
char cur[maxn];
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++) {
		#pragma GCC ivdep
		for(int i = 1; i < n; i += 2) if(cur[i] < cur[i-1]) swap(cur[i], cur[i-1]);
		#pragma GCC ivdep
		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 Runtime error 1 ms 492 KB Execution killed with signal 11
3 Correct 239 ms 492 KB Output is correct
4 Runtime error 1 ms 492 KB Execution killed with signal 11
5 Correct 1 ms 364 KB Output is correct
6 Correct 1368 ms 392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 364 KB Output is correct
2 Execution timed out 2075 ms 364 KB Time limit exceeded
3 Runtime error 1 ms 492 KB Execution killed with signal 11
4 Runtime error 2 ms 492 KB Execution killed with signal 11
5 Runtime error 1 ms 492 KB Execution killed with signal 11
6 Execution timed out 2061 ms 392 KB Time limit exceeded
7 Runtime error 2 ms 492 KB Execution killed with signal 11
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 Runtime error 1 ms 492 KB Execution killed with signal 11
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 1 ms 492 KB Execution killed with signal 11
16 Correct 1115 ms 364 KB Output is correct
17 Runtime error 1 ms 492 KB Execution killed with signal 11
18 Runtime error 1 ms 492 KB Execution killed with signal 11
19 Runtime error 1 ms 492 KB Execution killed with signal 11
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 1 ms 492 KB Execution killed with signal 11
24 Execution timed out 2077 ms 392 KB Time limit exceeded
25 Runtime error 2 ms 492 KB Execution killed with signal 11
26 Runtime error 1 ms 492 KB Execution killed with signal 11
27 Runtime error 2 ms 492 KB Execution killed with signal 11
28 Runtime error 2 ms 492 KB Execution killed with signal 11
29 Runtime error 1 ms 492 KB Execution killed with signal 11
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 492 KB Execution killed with signal 11
33 Execution timed out 2082 ms 364 KB Time limit exceeded
34 Correct 1514 ms 492 KB Output is correct
35 Runtime error 1 ms 492 KB Execution killed with signal 11
36 Runtime error 1 ms 528 KB Execution killed with signal 11
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 1600 ms 364 KB Output is correct
40 Runtime error 1 ms 492 KB Execution killed with signal 11
41 Runtime error 1 ms 492 KB Execution killed with signal 11
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