# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
272062 | 2020-08-18T08:32:23 Z | 문홍윤(#5109) | Archery (IOI09_archery) | C++17 | 2000 ms | 4216 KB |
#include <bits/stdc++.h> #define eb emplace_back #define mp make_pair #define F first #define S second #define all(x) x.begin(), x.end() #define svec(x) sort(x.begin(), x.end()) #define press(x) x.erase(unique(x.begin(), x.end()), x.end()) using namespace std; typedef long long LL; typedef pair<int, int> pii; typedef pair<LL, LL> pll; typedef pair<int, LL> pil; typedef pair<LL, int> pli; const LL llinf=2e18; const int inf=1e9; int n, r, arr[400010], p; int s[400010], ans=inf, tmp[200010]; void operate(){ for(int i=2; i<=n; i++)tmp[i]=min(s[2*i], s[2*i-1]); tmp[1]=max(s[1], s[2]); for(int i=2; i<n; i++){ if(s[2*i-1]<s[2*i])s[2*i-1]=tmp[i+1]; else s[2*i]=tmp[i+1]; } if(s[2*n-1]<s[2*n])s[2*n-1]=tmp[1]; else s[2*n]=tmp[1]; if(s[1]>s[2])s[1]=tmp[2]; else s[2]=tmp[2]; } int simulate(int num){ for(int i=1; i<num; i++)s[i]=arr[i]; s[num]=p; for(int i=num; i<=2*n-1; i++)s[i+1]=arr[i]; for(int i=1; i<=r; i++)operate(); for(int i=1; i<=2*n; i++){if(s[i]==p)return i;} } int main(){ scanf("%d %d", &n, &r); r=2*n+r%n; scanf("%d", &p); for(int i=1; i<=2*n-1; i++)scanf("%d", &arr[i]);\ int ans2; for(int i=1; i<=2*n; i++){ int t=simulate(i); if(ans>=t){ ans=t; ans2=i; } } printf("%d", ans2); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 512 KB | Output is correct |
2 | Execution timed out | 2070 ms | 384 KB | Time limit exceeded |
3 | Incorrect | 17 ms | 384 KB | Output isn't correct |
4 | Execution timed out | 2088 ms | 384 KB | Time limit exceeded |
5 | Incorrect | 0 ms | 384 KB | Output isn't correct |
6 | Incorrect | 106 ms | 384 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 384 KB | Output isn't correct |
2 | Incorrect | 115 ms | 384 KB | Output isn't correct |
3 | Execution timed out | 2079 ms | 384 KB | Time limit exceeded |
4 | Execution timed out | 2066 ms | 640 KB | Time limit exceeded |
5 | Execution timed out | 2077 ms | 3800 KB | Time limit exceeded |
6 | Incorrect | 96 ms | 384 KB | Output isn't correct |
7 | Execution timed out | 2093 ms | 384 KB | Time limit exceeded |
8 | Execution timed out | 2077 ms | 640 KB | Time limit exceeded |
9 | Execution timed out | 2066 ms | 768 KB | Time limit exceeded |
10 | Execution timed out | 2075 ms | 384 KB | Time limit exceeded |
11 | Execution timed out | 2029 ms | 768 KB | Time limit exceeded |
12 | Execution timed out | 2031 ms | 384 KB | Time limit exceeded |
13 | Execution timed out | 2068 ms | 2680 KB | Time limit exceeded |
14 | Execution timed out | 2056 ms | 384 KB | Time limit exceeded |
15 | Execution timed out | 2077 ms | 896 KB | Time limit exceeded |
16 | Incorrect | 122 ms | 384 KB | Output isn't correct |
17 | Execution timed out | 2021 ms | 384 KB | Time limit exceeded |
18 | Execution timed out | 2041 ms | 384 KB | Time limit exceeded |
19 | Execution timed out | 2067 ms | 384 KB | Time limit exceeded |
20 | Execution timed out | 2056 ms | 384 KB | Time limit exceeded |
21 | Execution timed out | 2072 ms | 768 KB | Time limit exceeded |
22 | Execution timed out | 2033 ms | 896 KB | Time limit exceeded |
23 | Execution timed out | 2023 ms | 3760 KB | Time limit exceeded |
24 | Incorrect | 119 ms | 504 KB | Output isn't correct |
25 | Execution timed out | 2085 ms | 384 KB | Time limit exceeded |
26 | Execution timed out | 2076 ms | 384 KB | Time limit exceeded |
27 | Execution timed out | 2090 ms | 768 KB | Time limit exceeded |
28 | Execution timed out | 2072 ms | 2808 KB | Time limit exceeded |
29 | Execution timed out | 2060 ms | 288 KB | Time limit exceeded |
30 | Execution timed out | 2074 ms | 384 KB | Time limit exceeded |
31 | Execution timed out | 2045 ms | 768 KB | Time limit exceeded |
32 | Execution timed out | 2080 ms | 3704 KB | Time limit exceeded |
33 | Incorrect | 114 ms | 384 KB | Output isn't correct |
34 | Incorrect | 96 ms | 504 KB | Output isn't correct |
35 | Execution timed out | 2075 ms | 384 KB | Time limit exceeded |
36 | Execution timed out | 2033 ms | 384 KB | Time limit exceeded |
37 | Execution timed out | 2047 ms | 640 KB | Time limit exceeded |
38 | Execution timed out | 2089 ms | 768 KB | Time limit exceeded |
39 | Incorrect | 95 ms | 384 KB | Output isn't correct |
40 | Execution timed out | 2089 ms | 384 KB | Time limit exceeded |
41 | Execution timed out | 2047 ms | 384 KB | Time limit exceeded |
42 | Execution timed out | 2079 ms | 384 KB | Time limit exceeded |
43 | Execution timed out | 2078 ms | 384 KB | Time limit exceeded |
44 | Execution timed out | 2083 ms | 512 KB | Time limit exceeded |
45 | Execution timed out | 2085 ms | 768 KB | Time limit exceeded |
46 | Execution timed out | 2091 ms | 768 KB | Time limit exceeded |
47 | Execution timed out | 2099 ms | 4216 KB | Time limit exceeded |