Submission #366864

# Submission time Handle Problem Language Result Execution time Memory
366864 2021-02-15T13:25:08 Z kostia244 Archery (IOI09_archery) C++17
20 / 100
132 ms 620 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]) {
			cur[i] ^= cur[i-1];
			cur[i-1] ^= cur[i];
			cur[i] ^= cur[i-1];
		}
		int FF = cur[1];
		#pragma GCC ivdep
		for(int i = 1; i+1 < n; i++) cur[i] = cur[i+1];
		cur[n-1] = FF;
	}
	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 13 ms 364 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 85 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 132 ms 492 KB Output is correct
3 Runtime error 1 ms 492 KB Execution killed with signal 11
4 Runtime error 1 ms 492 KB Execution killed with signal 11
5 Runtime error 1 ms 492 KB Execution killed with signal 11
6 Correct 114 ms 492 KB Output is correct
7 Runtime error 1 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 2 ms 492 KB Execution killed with signal 11
12 Runtime error 2 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 71 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 620 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 512 KB Execution killed with signal 11
23 Runtime error 2 ms 492 KB Execution killed with signal 11
24 Correct 100 ms 364 KB Output is correct
25 Runtime error 1 ms 492 KB Execution killed with signal 11
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 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 2 ms 492 KB Execution killed with signal 11
32 Runtime error 1 ms 492 KB Execution killed with signal 11
33 Correct 129 ms 364 KB Output is correct
34 Correct 99 ms 364 KB Output is correct
35 Runtime error 1 ms 492 KB Execution killed with signal 11
36 Runtime error 1 ms 492 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 81 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 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 492 KB Execution killed with signal 11