Submission #1006590

# Submission time Handle Problem Language Result Execution time Memory
1006590 2024-06-24T04:26:48 Z huutuan Archery (IOI09_archery) C++14
5 / 100
2000 ms 3924 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 Incorrect 0 ms 2396 KB Output isn't correct
2 Execution timed out 2085 ms 2396 KB Time limit exceeded
3 Incorrect 1361 ms 2488 KB Output isn't correct
4 Execution timed out 2066 ms 2396 KB Time limit exceeded
5 Correct 1 ms 2396 KB Output is correct
6 Execution timed out 2090 ms 2396 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Execution timed out 2029 ms 2396 KB Time limit exceeded
3 Execution timed out 2029 ms 2648 KB Time limit exceeded
4 Execution timed out 2050 ms 2392 KB Time limit exceeded
5 Execution timed out 2076 ms 3676 KB Time limit exceeded
6 Execution timed out 2005 ms 2392 KB Time limit exceeded
7 Execution timed out 2059 ms 2396 KB Time limit exceeded
8 Execution timed out 2067 ms 2396 KB Time limit exceeded
9 Execution timed out 2043 ms 2648 KB Time limit exceeded
10 Execution timed out 2048 ms 2396 KB Time limit exceeded
11 Execution timed out 2071 ms 2648 KB Time limit exceeded
12 Execution timed out 2032 ms 2392 KB Time limit exceeded
13 Execution timed out 2012 ms 3164 KB Time limit exceeded
14 Execution timed out 2033 ms 2392 KB Time limit exceeded
15 Execution timed out 2074 ms 2652 KB Time limit exceeded
16 Incorrect 40 ms 2648 KB Output isn't correct
17 Execution timed out 2065 ms 2396 KB Time limit exceeded
18 Execution timed out 2035 ms 2392 KB Time limit exceeded
19 Execution timed out 2036 ms 2392 KB Time limit exceeded
20 Execution timed out 2075 ms 2396 KB Time limit exceeded
21 Execution timed out 2048 ms 2652 KB Time limit exceeded
22 Execution timed out 2021 ms 2648 KB Time limit exceeded
23 Execution timed out 2047 ms 3664 KB Time limit exceeded
24 Incorrect 23 ms 2396 KB Output isn't correct
25 Execution timed out 2051 ms 2396 KB Time limit exceeded
26 Execution timed out 2069 ms 2396 KB Time limit exceeded
27 Execution timed out 2080 ms 2652 KB Time limit exceeded
28 Execution timed out 2056 ms 3164 KB Time limit exceeded
29 Execution timed out 2041 ms 2396 KB Time limit exceeded
30 Execution timed out 2068 ms 2396 KB Time limit exceeded
31 Execution timed out 2057 ms 2648 KB Time limit exceeded
32 Execution timed out 2035 ms 3672 KB Time limit exceeded
33 Correct 29 ms 2648 KB Output is correct
34 Execution timed out 2064 ms 2396 KB Time limit exceeded
35 Execution timed out 2050 ms 2392 KB Time limit exceeded
36 Execution timed out 2041 ms 2392 KB Time limit exceeded
37 Execution timed out 2071 ms 2396 KB Time limit exceeded
38 Execution timed out 2048 ms 2652 KB Time limit exceeded
39 Execution timed out 2020 ms 2396 KB Time limit exceeded
40 Execution timed out 2033 ms 2392 KB Time limit exceeded
41 Execution timed out 2045 ms 2392 KB Time limit exceeded
42 Execution timed out 2020 ms 2396 KB Time limit exceeded
43 Execution timed out 2076 ms 2392 KB Time limit exceeded
44 Execution timed out 2044 ms 2392 KB Time limit exceeded
45 Execution timed out 2048 ms 2652 KB Time limit exceeded
46 Execution timed out 2017 ms 2648 KB Time limit exceeded
47 Execution timed out 2071 ms 3924 KB Time limit exceeded