Submission #1067968

# Submission time Handle Problem Language Result Execution time Memory
1067968 2024-08-21T06:15:07 Z 12345678 Archery (IOI09_archery) C++17
0 / 100
2000 ms 1116 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=205;

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];
    for (int i=0; i<2*n; i++)
    {
        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<<res+1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Execution timed out 2087 ms 348 KB Time limit exceeded
3 Incorrect 8 ms 344 KB Output isn't correct
4 Execution timed out 2080 ms 348 KB Time limit exceeded
5 Incorrect 1 ms 348 KB Output isn't correct
6 Incorrect 41 ms 348 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Incorrect 51 ms 348 KB Output isn't correct
3 Execution timed out 2081 ms 344 KB Time limit exceeded
4 Execution timed out 2054 ms 348 KB Time limit exceeded
5 Runtime error 3 ms 1116 KB Execution killed with signal 11
6 Incorrect 42 ms 344 KB Output isn't correct
7 Execution timed out 2066 ms 348 KB Time limit exceeded
8 Execution timed out 2005 ms 344 KB Time limit exceeded
9 Execution timed out 2050 ms 348 KB Time limit exceeded
10 Execution timed out 2041 ms 348 KB Time limit exceeded
11 Execution timed out 2023 ms 348 KB Time limit exceeded
12 Execution timed out 2057 ms 348 KB Time limit exceeded
13 Runtime error 3 ms 1116 KB Execution killed with signal 11
14 Execution timed out 2096 ms 388 KB Time limit exceeded
15 Execution timed out 2083 ms 604 KB Time limit exceeded
16 Incorrect 78 ms 348 KB Output isn't correct
17 Execution timed out 2073 ms 348 KB Time limit exceeded
18 Execution timed out 2009 ms 344 KB Time limit exceeded
19 Execution timed out 2048 ms 344 KB Time limit exceeded
20 Execution timed out 2036 ms 344 KB Time limit exceeded
21 Execution timed out 2039 ms 344 KB Time limit exceeded
22 Execution timed out 2047 ms 600 KB Time limit exceeded
23 Runtime error 4 ms 1116 KB Execution killed with signal 11
24 Incorrect 50 ms 436 KB Output isn't correct
25 Execution timed out 2053 ms 344 KB Time limit exceeded
26 Execution timed out 2048 ms 348 KB Time limit exceeded
27 Execution timed out 2013 ms 344 KB Time limit exceeded
28 Runtime error 3 ms 1112 KB Execution killed with signal 11
29 Execution timed out 2020 ms 344 KB Time limit exceeded
30 Execution timed out 2083 ms 344 KB Time limit exceeded
31 Execution timed out 2023 ms 344 KB Time limit exceeded
32 Runtime error 4 ms 1112 KB Execution killed with signal 11
33 Incorrect 50 ms 348 KB Output isn't correct
34 Incorrect 44 ms 344 KB Output isn't correct
35 Execution timed out 2084 ms 348 KB Time limit exceeded
36 Execution timed out 2012 ms 344 KB Time limit exceeded
37 Execution timed out 2059 ms 348 KB Time limit exceeded
38 Execution timed out 2043 ms 600 KB Time limit exceeded
39 Incorrect 49 ms 348 KB Output isn't correct
40 Execution timed out 2064 ms 348 KB Time limit exceeded
41 Execution timed out 2031 ms 344 KB Time limit exceeded
42 Execution timed out 2039 ms 344 KB Time limit exceeded
43 Execution timed out 2068 ms 348 KB Time limit exceeded
44 Execution timed out 2041 ms 600 KB Time limit exceeded
45 Execution timed out 2012 ms 344 KB Time limit exceeded
46 Execution timed out 2065 ms 348 KB Time limit exceeded
47 Runtime error 4 ms 1116 KB Execution killed with signal 11