Submission #1068040

# Submission time Handle Problem Language Result Execution time Memory
1068040 2024-08-21T06:52:10 Z 12345678 Archery (IOI09_archery) C++17
20 / 100
83 ms 7296 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 3 ms 4956 KB Output is correct
2 Incorrect 2 ms 4956 KB Output isn't correct
3 Correct 8 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 38 ms 5140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5172 KB Output is correct
2 Correct 46 ms 4956 KB Output is correct
3 Incorrect 3 ms 4956 KB Output isn't correct
4 Incorrect 4 ms 5212 KB Output isn't correct
5 Incorrect 37 ms 7000 KB Output isn't correct
6 Correct 37 ms 4956 KB Output is correct
7 Incorrect 3 ms 4956 KB Output isn't correct
8 Incorrect 4 ms 5328 KB Output isn't correct
9 Incorrect 6 ms 5212 KB Output isn't correct
10 Incorrect 3 ms 4956 KB Output isn't correct
11 Incorrect 5 ms 5208 KB Output isn't correct
12 Incorrect 2 ms 4956 KB Output isn't correct
13 Incorrect 29 ms 6484 KB Output isn't correct
14 Incorrect 3 ms 5184 KB Output isn't correct
15 Incorrect 9 ms 5444 KB Output isn't correct
16 Correct 44 ms 4956 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 2 ms 5128 KB Output isn't correct
21 Incorrect 4 ms 5212 KB Output isn't correct
22 Incorrect 5 ms 5468 KB Output isn't correct
23 Incorrect 23 ms 7296 KB Output isn't correct
24 Correct 83 ms 5152 KB Output is correct
25 Incorrect 3 ms 4956 KB Output isn't correct
26 Incorrect 3 ms 5064 KB Output isn't correct
27 Incorrect 4 ms 5212 KB Output isn't correct
28 Incorrect 18 ms 6616 KB Output isn't correct
29 Incorrect 2 ms 4956 KB Output isn't correct
30 Incorrect 2 ms 5212 KB Output isn't correct
31 Incorrect 4 ms 5192 KB Output isn't correct
32 Incorrect 23 ms 6996 KB Output isn't correct
33 Correct 45 ms 4952 KB Output is correct
34 Correct 39 ms 4952 KB Output is correct
35 Incorrect 2 ms 4952 KB Output isn't correct
36 Incorrect 3 ms 4952 KB Output isn't correct
37 Incorrect 4 ms 5216 KB Output isn't correct
38 Incorrect 5 ms 5212 KB Output isn't correct
39 Correct 71 ms 4956 KB Output is correct
40 Incorrect 2 ms 4956 KB Output isn't correct
41 Incorrect 2 ms 5060 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 4 ms 5212 KB Output isn't correct
46 Incorrect 4 ms 5212 KB Output isn't correct
47 Incorrect 26 ms 7248 KB Output isn't correct