Submission #1068070

# Submission time Handle Problem Language Result Execution time Memory
1068070 2024-08-21T07:06:19 Z 12345678 Archery (IOI09_archery) C++17
31 / 100
78 ms 5208 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<<n, 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];
            for (int j=0; j<2*n; j++) pw[j]=npw[j];
        }
        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 2 ms 4956 KB Output is correct
2 Correct 2 ms 4956 KB Output is correct
3 Correct 14 ms 4956 KB Output is correct
4 Incorrect 2 ms 4956 KB Output isn't correct
5 Correct 3 ms 4956 KB Output is correct
6 Correct 39 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4956 KB Output is correct
2 Correct 48 ms 4956 KB Output is correct
3 Incorrect 3 ms 4956 KB Output isn't correct
4 Incorrect 3 ms 4956 KB Output isn't correct
5 Correct 19 ms 5172 KB Output is correct
6 Correct 37 ms 4956 KB Output is correct
7 Incorrect 3 ms 4956 KB Output isn't correct
8 Incorrect 6 ms 4956 KB Output isn't correct
9 Correct 6 ms 4956 KB Output is correct
10 Incorrect 2 ms 5172 KB Output isn't correct
11 Incorrect 4 ms 5168 KB Output isn't correct
12 Incorrect 2 ms 4956 KB Output isn't correct
13 Incorrect 14 ms 4956 KB Output isn't correct
14 Incorrect 3 ms 4952 KB Output isn't correct
15 Incorrect 5 ms 5168 KB Output isn't correct
16 Correct 49 ms 4956 KB Output is correct
17 Incorrect 3 ms 4956 KB Output isn't correct
18 Incorrect 2 ms 4956 KB Output isn't correct
19 Correct 2 ms 4956 KB Output is correct
20 Correct 4 ms 4956 KB Output is correct
21 Incorrect 6 ms 4956 KB Output isn't correct
22 Correct 9 ms 4956 KB Output is correct
23 Incorrect 23 ms 4952 KB Output isn't correct
24 Correct 78 ms 4952 KB Output is correct
25 Incorrect 2 ms 4952 KB Output isn't correct
26 Incorrect 2 ms 4956 KB Output isn't correct
27 Incorrect 4 ms 4956 KB Output isn't correct
28 Incorrect 26 ms 5208 KB Output isn't correct
29 Incorrect 2 ms 4956 KB Output isn't correct
30 Incorrect 2 ms 4992 KB Output isn't correct
31 Incorrect 4 ms 4956 KB Output isn't correct
32 Incorrect 21 ms 5176 KB Output isn't correct
33 Correct 45 ms 4956 KB Output is correct
34 Correct 74 ms 4956 KB Output is correct
35 Incorrect 3 ms 4952 KB Output isn't correct
36 Incorrect 3 ms 4956 KB Output isn't correct
37 Incorrect 4 ms 4956 KB Output isn't correct
38 Incorrect 4 ms 5112 KB Output isn't correct
39 Correct 38 ms 4952 KB Output is correct
40 Incorrect 4 ms 4956 KB Output isn't correct
41 Incorrect 4 ms 5168 KB Output isn't correct
42 Incorrect 2 ms 4956 KB Output isn't correct
43 Incorrect 4 ms 4956 KB Output isn't correct
44 Incorrect 3 ms 4952 KB Output isn't correct
45 Incorrect 6 ms 5016 KB Output isn't correct
46 Incorrect 7 ms 4952 KB Output isn't correct
47 Incorrect 23 ms 5168 KB Output isn't correct