# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
744644 |
2023-05-18T21:59:35 Z |
oolimry |
Archery (IOI09_archery) |
C++17 |
|
2000 ms |
12796 KB |
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int) (x).size()
#define all(x) (x).begin(), (x).end()
#define show(x) cerr << #x << " is " << x << endl;
#define show2(x,y) cerr << #x << " is " << x << " " << #y << " is " << y << endl;
#define show3(x,y,z) cerr << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << endl;
typedef long long lint;
typedef pair<lint,lint> ii;
int arr[400005];
int target[400005];
int n, R;
int me;
int solve(int s){
target[me] = s;
for(int i = 1;i <= 2*n;i++){
int newi = i + (i >= 2*s);
target[arr[i]] = (newi+1)/2;
}
//for(int i = 1;i <= 2*n;i++) show2(i, target[i]);
if(me >= n+2){ ///weak
set<int> available;
for(int i = 2;i <= n;i++) available.insert(i);
for(int i = 2*n;i >= me;i--){
auto it = available.upper_bound(target[i]);
if(it == available.begin()) it = --available.end();
else it--;
if(i == me) return *it;
available.erase(it);
}
}
else{ ///strong
assert(false);
}
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
cin >> n >> R;
cin >> me;
if(me == 1){
cout << n;
return 0;
}
for(int i = 1;i <= 2*n-1;i++) cin >> arr[i];
int bestPos = -1;
int bestVal = n;
for(int t = 1;t <= n;t++){
int res = solve(t);
if(res <= bestVal){
bestVal = res;
bestPos = t;
}
}
cout << bestPos;
}
Compilation message
archery.cpp: In function 'int solve(int)':
archery.cpp:42:1: warning: control reaches end of non-void function [-Wreturn-type]
42 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
4 |
Runtime error |
1 ms |
544 KB |
Execution killed with signal 6 |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
2 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
3 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
4 |
Runtime error |
3 ms |
980 KB |
Execution killed with signal 6 |
5 |
Runtime error |
37 ms |
5804 KB |
Execution killed with signal 6 |
6 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
7 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
8 |
Runtime error |
3 ms |
980 KB |
Execution killed with signal 6 |
9 |
Runtime error |
4 ms |
1108 KB |
Execution killed with signal 6 |
10 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
11 |
Runtime error |
4 ms |
1108 KB |
Execution killed with signal 6 |
12 |
Runtime error |
2 ms |
596 KB |
Execution killed with signal 6 |
13 |
Runtime error |
21 ms |
4380 KB |
Execution killed with signal 6 |
14 |
Runtime error |
2 ms |
600 KB |
Execution killed with signal 6 |
15 |
Runtime error |
6 ms |
1492 KB |
Execution killed with signal 6 |
16 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
17 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
18 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
19 |
Runtime error |
2 ms |
596 KB |
Execution killed with signal 6 |
20 |
Runtime error |
2 ms |
596 KB |
Execution killed with signal 6 |
21 |
Runtime error |
4 ms |
1108 KB |
Execution killed with signal 6 |
22 |
Runtime error |
5 ms |
1492 KB |
Execution killed with signal 6 |
23 |
Runtime error |
30 ms |
6188 KB |
Execution killed with signal 6 |
24 |
Correct |
4 ms |
344 KB |
Output is correct |
25 |
Correct |
125 ms |
376 KB |
Output is correct |
26 |
Execution timed out |
2073 ms |
648 KB |
Time limit exceeded |
27 |
Execution timed out |
2054 ms |
1620 KB |
Time limit exceeded |
28 |
Execution timed out |
2068 ms |
8220 KB |
Time limit exceeded |
29 |
Correct |
250 ms |
340 KB |
Output is correct |
30 |
Execution timed out |
2093 ms |
596 KB |
Time limit exceeded |
31 |
Execution timed out |
2066 ms |
1492 KB |
Time limit exceeded |
32 |
Execution timed out |
2066 ms |
11212 KB |
Time limit exceeded |
33 |
Correct |
4 ms |
212 KB |
Output is correct |
34 |
Correct |
3 ms |
340 KB |
Output is correct |
35 |
Correct |
547 ms |
444 KB |
Output is correct |
36 |
Correct |
834 ms |
468 KB |
Output is correct |
37 |
Execution timed out |
2067 ms |
1364 KB |
Time limit exceeded |
38 |
Execution timed out |
2087 ms |
1876 KB |
Time limit exceeded |
39 |
Correct |
4 ms |
212 KB |
Output is correct |
40 |
Correct |
126 ms |
376 KB |
Output is correct |
41 |
Correct |
589 ms |
440 KB |
Output is correct |
42 |
Correct |
783 ms |
468 KB |
Output is correct |
43 |
Execution timed out |
2073 ms |
596 KB |
Time limit exceeded |
44 |
Execution timed out |
2067 ms |
852 KB |
Time limit exceeded |
45 |
Execution timed out |
2072 ms |
1492 KB |
Time limit exceeded |
46 |
Execution timed out |
2072 ms |
1688 KB |
Time limit exceeded |
47 |
Execution timed out |
2070 ms |
12796 KB |
Time limit exceeded |