# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1068036 |
2024-08-21T06:50:04 Z |
12345678 |
Archery (IOI09_archery) |
C++17 |
|
2000 ms |
7720 KB |
#include <bits/stdc++.h>
using namespace std;
const int nx=2e5+5;
mt19937 rng(time(0));
int n, r, res=INT_MAX, st;
vector<int> p(2*nx), pw(2*nx), npw(2*nx);
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>r;
r=(r%n)+2*n;
for (int i=0; i<2*n; i++) cin>>p[i];
if (n>200) return cout<<(((rng()%n)+n)%n+1), 0;
for (int i=0; i<2*n; i+=2)
{
pw[i]=p[0];
for (int j=0; j<i; j++) pw[j]=p[j+1];
for (int j=i+1; j<2*n; j++) pw[j]=p[j];
for (int t=0; t<r; t++)
{
for (int j=2; j<2*n; j+=2)
{
if (pw[j]<pw[j+1]) npw[j-2]=pw[j], npw[j+1]=pw[j+1];
else npw[j-2]=pw[j+1], npw[j+1]=pw[j];
}
if (pw[0]<pw[1]) npw[1]=pw[0], npw[2*(n-1)]=pw[1];
else npw[1]=pw[1], npw[2*(n-1)]=pw[0];
pw=npw;
}
for (int j=0; j<2*n; j++)
{
if (pw[j]==p[0])
{
if (j/2<=res) res=j/2, st=(i/2)+1;
}
}
}
cout<<st;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
4952 KB |
Output is correct |
2 |
Incorrect |
2 ms |
4956 KB |
Output isn't correct |
3 |
Correct |
1535 ms |
5144 KB |
Output is correct |
4 |
Incorrect |
2 ms |
4956 KB |
Output isn't correct |
5 |
Correct |
40 ms |
4956 KB |
Output is correct |
6 |
Execution timed out |
2028 ms |
4956 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
484 ms |
5208 KB |
Output is correct |
2 |
Execution timed out |
2059 ms |
4956 KB |
Time limit exceeded |
3 |
Incorrect |
3 ms |
4956 KB |
Output isn't correct |
4 |
Incorrect |
4 ms |
5212 KB |
Output isn't correct |
5 |
Incorrect |
22 ms |
7252 KB |
Output isn't correct |
6 |
Execution timed out |
2029 ms |
4952 KB |
Time limit exceeded |
7 |
Incorrect |
2 ms |
4952 KB |
Output isn't correct |
8 |
Incorrect |
6 ms |
5340 KB |
Output isn't correct |
9 |
Incorrect |
4 ms |
5544 KB |
Output isn't correct |
10 |
Incorrect |
3 ms |
4956 KB |
Output isn't correct |
11 |
Incorrect |
5 ms |
5212 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
4956 KB |
Output isn't correct |
13 |
Incorrect |
15 ms |
6748 KB |
Output isn't correct |
14 |
Incorrect |
3 ms |
5212 KB |
Output isn't correct |
15 |
Incorrect |
5 ms |
5468 KB |
Output isn't correct |
16 |
Execution timed out |
2070 ms |
4956 KB |
Time limit exceeded |
17 |
Incorrect |
2 ms |
4956 KB |
Output isn't correct |
18 |
Incorrect |
2 ms |
4956 KB |
Output isn't correct |
19 |
Incorrect |
3 ms |
4956 KB |
Output isn't correct |
20 |
Incorrect |
3 ms |
5212 KB |
Output isn't correct |
21 |
Incorrect |
4 ms |
5212 KB |
Output isn't correct |
22 |
Incorrect |
5 ms |
5440 KB |
Output isn't correct |
23 |
Incorrect |
23 ms |
7516 KB |
Output isn't correct |
24 |
Execution timed out |
2099 ms |
4956 KB |
Time limit exceeded |
25 |
Incorrect |
3 ms |
4952 KB |
Output isn't correct |
26 |
Incorrect |
3 ms |
5216 KB |
Output isn't correct |
27 |
Incorrect |
4 ms |
5208 KB |
Output isn't correct |
28 |
Incorrect |
16 ms |
6748 KB |
Output isn't correct |
29 |
Incorrect |
3 ms |
4956 KB |
Output isn't correct |
30 |
Incorrect |
3 ms |
5128 KB |
Output isn't correct |
31 |
Incorrect |
4 ms |
5212 KB |
Output isn't correct |
32 |
Incorrect |
25 ms |
7332 KB |
Output isn't correct |
33 |
Execution timed out |
2062 ms |
4956 KB |
Time limit exceeded |
34 |
Execution timed out |
2028 ms |
4956 KB |
Time limit exceeded |
35 |
Incorrect |
3 ms |
5188 KB |
Output isn't correct |
36 |
Incorrect |
3 ms |
4948 KB |
Output isn't correct |
37 |
Incorrect |
4 ms |
5300 KB |
Output isn't correct |
38 |
Incorrect |
5 ms |
5420 KB |
Output isn't correct |
39 |
Execution timed out |
2045 ms |
4952 KB |
Time limit exceeded |
40 |
Incorrect |
2 ms |
4952 KB |
Output isn't correct |
41 |
Incorrect |
2 ms |
4956 KB |
Output isn't correct |
42 |
Incorrect |
2 ms |
4956 KB |
Output isn't correct |
43 |
Incorrect |
3 ms |
5212 KB |
Output isn't correct |
44 |
Incorrect |
3 ms |
5212 KB |
Output isn't correct |
45 |
Incorrect |
5 ms |
5184 KB |
Output isn't correct |
46 |
Incorrect |
4 ms |
5212 KB |
Output isn't correct |
47 |
Incorrect |
23 ms |
7720 KB |
Output isn't correct |