Submission #1006592

# Submission time Handle Problem Language Result Execution time Memory
1006592 2024-06-24T04:41:43 Z huutuan Archery (IOI09_archery) C++14
22 / 100
2000 ms 3984 KB
#include <bits/stdc++.h>

using namespace std;

const int N=5e5+10;
int n, r, s, a[N], b[N];

int32_t main(){
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   cin >> n >> r >> s;
   r=(r-n*2)%(n*2)+n*2;
   for (int i=1; i<n*2; ++i) cin >> b[i];
   pair<int, int> ans={n*2, n};
   for (int i=1; i<=n; ++i){
      for (int j=1; j<i*2; ++j) a[j]=b[j];
      a[i*2]=s;
      for (int j=i*2+1; j<=n*2; ++j) a[j]=b[j-1];
      for (int _=1; _<=r; ++_){
         for (int j=1; j<=n*2; j+=2) if (a[j]>a[j+1]) swap(a[j], a[j+1]);
         swap(a[1], a[2]);
         int tmp=a[1];
         for (int j=3; j<=n*2; j+=2) a[j-2]=a[j];
         a[n*2-1]=tmp;
      }
      int pos=0;
      for (int j=1; j<=n*2; ++j) if (a[j]==s) pos=(j+1)/2;
      ans=min(ans, {pos, -i});
   }
   cout << -ans.second << '\n';
   return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Execution timed out 2090 ms 2396 KB Time limit exceeded
3 Correct 4 ms 2396 KB Output is correct
4 Execution timed out 2096 ms 2396 KB Time limit exceeded
5 Correct 1 ms 2392 KB Output is correct
6 Correct 19 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 21 ms 2516 KB Output is correct
3 Execution timed out 2096 ms 2396 KB Time limit exceeded
4 Execution timed out 2065 ms 2396 KB Time limit exceeded
5 Execution timed out 2043 ms 3672 KB Time limit exceeded
6 Correct 18 ms 2396 KB Output is correct
7 Correct 1437 ms 2504 KB Output is correct
8 Execution timed out 2077 ms 2396 KB Time limit exceeded
9 Execution timed out 2057 ms 2652 KB Time limit exceeded
10 Execution timed out 2033 ms 2392 KB Time limit exceeded
11 Execution timed out 2050 ms 2652 KB Time limit exceeded
12 Execution timed out 2029 ms 2392 KB Time limit exceeded
13 Execution timed out 2040 ms 3160 KB Time limit exceeded
14 Execution timed out 2073 ms 2396 KB Time limit exceeded
15 Execution timed out 2071 ms 2652 KB Time limit exceeded
16 Correct 23 ms 2392 KB Output is correct
17 Execution timed out 2064 ms 2396 KB Time limit exceeded
18 Execution timed out 2075 ms 2396 KB Time limit exceeded
19 Execution timed out 2050 ms 2396 KB Time limit exceeded
20 Execution timed out 2041 ms 2392 KB Time limit exceeded
21 Execution timed out 2100 ms 2648 KB Time limit exceeded
22 Execution timed out 2040 ms 2652 KB Time limit exceeded
23 Execution timed out 2064 ms 3676 KB Time limit exceeded
24 Correct 19 ms 2392 KB Output is correct
25 Execution timed out 2099 ms 2396 KB Time limit exceeded
26 Execution timed out 2025 ms 2392 KB Time limit exceeded
27 Execution timed out 2057 ms 2648 KB Time limit exceeded
28 Execution timed out 2051 ms 3164 KB Time limit exceeded
29 Execution timed out 2071 ms 2396 KB Time limit exceeded
30 Execution timed out 2041 ms 2392 KB Time limit exceeded
31 Execution timed out 2077 ms 2652 KB Time limit exceeded
32 Execution timed out 2062 ms 3676 KB Time limit exceeded
33 Correct 26 ms 2648 KB Output is correct
34 Correct 17 ms 2392 KB Output is correct
35 Execution timed out 2100 ms 2396 KB Time limit exceeded
36 Execution timed out 2086 ms 2392 KB Time limit exceeded
37 Execution timed out 2047 ms 2648 KB Time limit exceeded
38 Execution timed out 2028 ms 2904 KB Time limit exceeded
39 Correct 23 ms 2396 KB Output is correct
40 Execution timed out 2093 ms 2396 KB Time limit exceeded
41 Execution timed out 2061 ms 2396 KB Time limit exceeded
42 Execution timed out 2040 ms 2392 KB Time limit exceeded
43 Execution timed out 2044 ms 2392 KB Time limit exceeded
44 Execution timed out 2098 ms 2392 KB Time limit exceeded
45 Execution timed out 2066 ms 2652 KB Time limit exceeded
46 Execution timed out 2095 ms 2652 KB Time limit exceeded
47 Execution timed out 2093 ms 3984 KB Time limit exceeded