Submission #1067981

# Submission time Handle Problem Language Result Execution time Memory
1067981 2024-08-21T06:22:02 Z 12345678 Archery (IOI09_archery) C++17
20 / 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+=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;
        }
        //cout<<"st "<<i<<": ";
        //for (int j=0; j<2*n; j++) cout<<pw[j]<<' ';
        //cout<<'\n';
        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 1 ms 344 KB Output is correct
2 Execution timed out 2053 ms 348 KB Time limit exceeded
3 Correct 4 ms 344 KB Output is correct
4 Execution timed out 2029 ms 344 KB Time limit exceeded
5 Correct 1 ms 348 KB Output is correct
6 Correct 22 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 27 ms 456 KB Output is correct
3 Execution timed out 2051 ms 348 KB Time limit exceeded
4 Execution timed out 2035 ms 344 KB Time limit exceeded
5 Runtime error 4 ms 1116 KB Execution killed with signal 11
6 Correct 21 ms 348 KB Output is correct
7 Runtime error 1721 ms 452 KB Execution killed with signal 6
8 Execution timed out 2045 ms 344 KB Time limit exceeded
9 Execution timed out 2071 ms 348 KB Time limit exceeded
10 Execution timed out 2028 ms 344 KB Time limit exceeded
11 Execution timed out 2050 ms 348 KB Time limit exceeded
12 Execution timed out 2041 ms 348 KB Time limit exceeded
13 Runtime error 3 ms 1116 KB Execution killed with signal 11
14 Execution timed out 2098 ms 348 KB Time limit exceeded
15 Execution timed out 2037 ms 600 KB Time limit exceeded
16 Correct 25 ms 344 KB Output is correct
17 Execution timed out 2048 ms 348 KB Time limit exceeded
18 Execution timed out 2057 ms 348 KB Time limit exceeded
19 Execution timed out 2064 ms 348 KB Time limit exceeded
20 Execution timed out 2095 ms 476 KB Time limit exceeded
21 Execution timed out 2063 ms 348 KB Time limit exceeded
22 Execution timed out 2049 ms 604 KB Time limit exceeded
23 Runtime error 4 ms 1116 KB Execution killed with signal 11
24 Correct 26 ms 456 KB Output is correct
25 Execution timed out 2023 ms 600 KB Time limit exceeded
26 Execution timed out 2095 ms 344 KB Time limit exceeded
27 Execution timed out 2037 ms 344 KB Time limit exceeded
28 Runtime error 3 ms 1116 KB Execution killed with signal 11
29 Execution timed out 2053 ms 344 KB Time limit exceeded
30 Execution timed out 2027 ms 344 KB Time limit exceeded
31 Execution timed out 2043 ms 348 KB Time limit exceeded
32 Runtime error 4 ms 1116 KB Execution killed with signal 11
33 Correct 30 ms 348 KB Output is correct
34 Correct 22 ms 348 KB Output is correct
35 Execution timed out 2097 ms 348 KB Time limit exceeded
36 Execution timed out 2028 ms 344 KB Time limit exceeded
37 Execution timed out 2024 ms 344 KB Time limit exceeded
38 Execution timed out 2041 ms 600 KB Time limit exceeded
39 Correct 22 ms 344 KB Output is correct
40 Execution timed out 2071 ms 348 KB Time limit exceeded
41 Execution timed out 2044 ms 348 KB Time limit exceeded
42 Execution timed out 2064 ms 344 KB Time limit exceeded
43 Execution timed out 2008 ms 344 KB Time limit exceeded
44 Execution timed out 2005 ms 344 KB Time limit exceeded
45 Execution timed out 2070 ms 348 KB Time limit exceeded
46 Execution timed out 2067 ms 604 KB Time limit exceeded
47 Runtime error 4 ms 1112 KB Execution killed with signal 11