Submission #1068067

# Submission time Handle Problem Language Result Execution time Memory
1068067 2024-08-21T07:05:18 Z 12345678 Archery (IOI09_archery) C++17
20 / 100
48 ms 5180 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];
            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 Incorrect 2 ms 5172 KB Output isn't correct
3 Correct 7 ms 5168 KB Output is correct
4 Incorrect 2 ms 4956 KB Output isn't correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 36 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4956 KB Output is correct
2 Correct 46 ms 5148 KB Output is correct
3 Incorrect 4 ms 4956 KB Output isn't correct
4 Incorrect 3 ms 4956 KB Output isn't correct
5 Incorrect 20 ms 5180 KB Output isn't correct
6 Correct 47 ms 4952 KB Output is correct
7 Incorrect 2 ms 4956 KB Output isn't correct
8 Incorrect 3 ms 5172 KB Output isn't correct
9 Incorrect 4 ms 5176 KB Output isn't correct
10 Incorrect 2 ms 4956 KB Output isn't correct
11 Incorrect 4 ms 4956 KB Output isn't correct
12 Incorrect 2 ms 4956 KB Output isn't correct
13 Incorrect 15 ms 4956 KB Output isn't correct
14 Incorrect 2 ms 4956 KB Output isn't correct
15 Incorrect 6 ms 4956 KB Output isn't correct
16 Correct 48 ms 5148 KB Output is correct
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 4956 KB Output isn't correct
21 Incorrect 4 ms 5168 KB Output isn't correct
22 Incorrect 8 ms 4956 KB Output isn't correct
23 Incorrect 23 ms 4952 KB Output isn't correct
24 Correct 47 ms 4960 KB Output is correct
25 Incorrect 2 ms 4956 KB Output isn't correct
26 Incorrect 2 ms 5172 KB Output isn't correct
27 Incorrect 4 ms 5116 KB Output isn't correct
28 Incorrect 15 ms 5180 KB Output isn't correct
29 Incorrect 2 ms 5088 KB Output isn't correct
30 Incorrect 2 ms 4956 KB Output isn't correct
31 Incorrect 4 ms 4956 KB Output isn't correct
32 Incorrect 21 ms 5172 KB Output isn't correct
33 Correct 45 ms 4956 KB Output is correct
34 Correct 47 ms 5156 KB Output is correct
35 Incorrect 2 ms 4952 KB Output isn't correct
36 Incorrect 2 ms 4956 KB Output isn't correct
37 Incorrect 3 ms 5028 KB Output isn't correct
38 Incorrect 4 ms 4956 KB Output isn't correct
39 Correct 37 ms 5148 KB Output is correct
40 Incorrect 3 ms 4956 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 4956 KB Output isn't correct
44 Incorrect 3 ms 4956 KB Output isn't correct
45 Incorrect 4 ms 4956 KB Output isn't correct
46 Incorrect 4 ms 5168 KB Output isn't correct
47 Incorrect 23 ms 5176 KB Output isn't correct