#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<int> comp_pos(int N, int R, vector<int> A) {
R=2*N+(R%N);
for(int i=0;i<R;i++) {
for(int j=0;j<N;j++) if(A[j<<1]>A[j<<1|1]) swap(A[j<<1],A[j<<1|1]);
int wtf = A[1];
A[1] = A[2];
for(int i=2;i<2*N-2;i+=2) A[i]=A[i+2];
A[2*N-2]=wtf;
}
return A;
}
main() {
int N, R; cin >> N >> R;
vector<int> A(2*N); for(int i=0;i<2*N;i++) cin>>A[i];
pair<int,int> best = {5e5,0};
for(int i=1;i<2*N;i++) {
swap(A[i-1],A[i]);
vector<int> u = comp_pos(N,R,A);
for(int j=0;j<2*N;j++) if(u[j]==A[i]) best=min(best,{j>>1,-(i>>1)});
}
cout << 1-best.second;
}
Compilation message
archery.cpp:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
15 | main() {
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Execution timed out |
2093 ms |
348 KB |
Time limit exceeded |
3 |
Correct |
6 ms |
348 KB |
Output is correct |
4 |
Execution timed out |
2074 ms |
348 KB |
Time limit exceeded |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
37 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
47 ms |
348 KB |
Output is correct |
3 |
Execution timed out |
2080 ms |
348 KB |
Time limit exceeded |
4 |
Execution timed out |
2017 ms |
1104 KB |
Time limit exceeded |
5 |
Execution timed out |
2050 ms |
7508 KB |
Time limit exceeded |
6 |
Correct |
37 ms |
344 KB |
Output is correct |
7 |
Execution timed out |
2066 ms |
348 KB |
Time limit exceeded |
8 |
Execution timed out |
2048 ms |
864 KB |
Time limit exceeded |
9 |
Execution timed out |
2021 ms |
1040 KB |
Time limit exceeded |
10 |
Execution timed out |
2070 ms |
348 KB |
Time limit exceeded |
11 |
Execution timed out |
2072 ms |
1116 KB |
Time limit exceeded |
12 |
Execution timed out |
2028 ms |
344 KB |
Time limit exceeded |
13 |
Execution timed out |
2049 ms |
5456 KB |
Time limit exceeded |
14 |
Execution timed out |
2051 ms |
344 KB |
Time limit exceeded |
15 |
Execution timed out |
2061 ms |
1372 KB |
Time limit exceeded |
16 |
Correct |
49 ms |
344 KB |
Output is correct |
17 |
Execution timed out |
2040 ms |
348 KB |
Time limit exceeded |
18 |
Execution timed out |
2052 ms |
348 KB |
Time limit exceeded |
19 |
Execution timed out |
2066 ms |
348 KB |
Time limit exceeded |
20 |
Execution timed out |
2035 ms |
344 KB |
Time limit exceeded |
21 |
Execution timed out |
2080 ms |
1032 KB |
Time limit exceeded |
22 |
Execution timed out |
2033 ms |
1368 KB |
Time limit exceeded |
23 |
Execution timed out |
2044 ms |
8020 KB |
Time limit exceeded |
24 |
Correct |
45 ms |
348 KB |
Output is correct |
25 |
Execution timed out |
2073 ms |
348 KB |
Time limit exceeded |
26 |
Execution timed out |
2048 ms |
348 KB |
Time limit exceeded |
27 |
Execution timed out |
2058 ms |
1032 KB |
Time limit exceeded |
28 |
Execution timed out |
2063 ms |
5712 KB |
Time limit exceeded |
29 |
Execution timed out |
2036 ms |
344 KB |
Time limit exceeded |
30 |
Execution timed out |
2070 ms |
348 KB |
Time limit exceeded |
31 |
Execution timed out |
2015 ms |
1056 KB |
Time limit exceeded |
32 |
Execution timed out |
2058 ms |
7900 KB |
Time limit exceeded |
33 |
Correct |
52 ms |
348 KB |
Output is correct |
34 |
Correct |
40 ms |
348 KB |
Output is correct |
35 |
Execution timed out |
2063 ms |
344 KB |
Time limit exceeded |
36 |
Execution timed out |
2043 ms |
348 KB |
Time limit exceeded |
37 |
Execution timed out |
2045 ms |
856 KB |
Time limit exceeded |
38 |
Execution timed out |
2001 ms |
1224 KB |
Time limit exceeded |
39 |
Correct |
37 ms |
344 KB |
Output is correct |
40 |
Execution timed out |
2058 ms |
348 KB |
Time limit exceeded |
41 |
Execution timed out |
2074 ms |
348 KB |
Time limit exceeded |
42 |
Execution timed out |
2102 ms |
344 KB |
Time limit exceeded |
43 |
Execution timed out |
2072 ms |
348 KB |
Time limit exceeded |
44 |
Execution timed out |
2037 ms |
692 KB |
Time limit exceeded |
45 |
Execution timed out |
2063 ms |
860 KB |
Time limit exceeded |
46 |
Execution timed out |
2083 ms |
1116 KB |
Time limit exceeded |
47 |
Execution timed out |
2051 ms |
9040 KB |
Time limit exceeded |