# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
744642 | 2023-05-18T21:57:50 Z | oolimry | Archery (IOI09_archery) | C++17 | 3 ms | 516 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(){ freopen("i.txt","r",stdin); 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 340 KB | Output isn't correct |
2 | Incorrect | 2 ms | 340 KB | Output isn't correct |
3 | Incorrect | 2 ms | 340 KB | Output isn't correct |
4 | Incorrect | 2 ms | 340 KB | Output isn't correct |
5 | Incorrect | 2 ms | 340 KB | Output isn't correct |
6 | Incorrect | 2 ms | 340 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 340 KB | Output isn't correct |
2 | Incorrect | 2 ms | 340 KB | Output isn't correct |
3 | Incorrect | 2 ms | 340 KB | Output isn't correct |
4 | Incorrect | 2 ms | 340 KB | Output isn't correct |
5 | Incorrect | 2 ms | 340 KB | Output isn't correct |
6 | Incorrect | 2 ms | 340 KB | Output isn't correct |
7 | Incorrect | 2 ms | 340 KB | Output isn't correct |
8 | Incorrect | 2 ms | 340 KB | Output isn't correct |
9 | Incorrect | 2 ms | 340 KB | Output isn't correct |
10 | Incorrect | 2 ms | 340 KB | Output isn't correct |
11 | Incorrect | 2 ms | 340 KB | Output isn't correct |
12 | Incorrect | 2 ms | 340 KB | Output isn't correct |
13 | Incorrect | 2 ms | 396 KB | Output isn't correct |
14 | Incorrect | 2 ms | 340 KB | Output isn't correct |
15 | Incorrect | 2 ms | 340 KB | Output isn't correct |
16 | Incorrect | 2 ms | 340 KB | Output isn't correct |
17 | Incorrect | 3 ms | 340 KB | Output isn't correct |
18 | Incorrect | 2 ms | 340 KB | Output isn't correct |
19 | Incorrect | 2 ms | 340 KB | Output isn't correct |
20 | Incorrect | 2 ms | 340 KB | Output isn't correct |
21 | Incorrect | 2 ms | 340 KB | Output isn't correct |
22 | Incorrect | 2 ms | 340 KB | Output isn't correct |
23 | Incorrect | 2 ms | 340 KB | Output isn't correct |
24 | Incorrect | 2 ms | 340 KB | Output isn't correct |
25 | Incorrect | 2 ms | 340 KB | Output isn't correct |
26 | Incorrect | 2 ms | 400 KB | Output isn't correct |
27 | Incorrect | 2 ms | 340 KB | Output isn't correct |
28 | Incorrect | 2 ms | 340 KB | Output isn't correct |
29 | Incorrect | 2 ms | 340 KB | Output isn't correct |
30 | Incorrect | 2 ms | 340 KB | Output isn't correct |
31 | Incorrect | 2 ms | 340 KB | Output isn't correct |
32 | Incorrect | 2 ms | 340 KB | Output isn't correct |
33 | Incorrect | 2 ms | 340 KB | Output isn't correct |
34 | Incorrect | 2 ms | 340 KB | Output isn't correct |
35 | Incorrect | 2 ms | 340 KB | Output isn't correct |
36 | Incorrect | 2 ms | 340 KB | Output isn't correct |
37 | Incorrect | 2 ms | 340 KB | Output isn't correct |
38 | Incorrect | 2 ms | 340 KB | Output isn't correct |
39 | Incorrect | 2 ms | 420 KB | Output isn't correct |
40 | Incorrect | 2 ms | 340 KB | Output isn't correct |
41 | Incorrect | 2 ms | 340 KB | Output isn't correct |
42 | Incorrect | 2 ms | 516 KB | Output isn't correct |
43 | Incorrect | 3 ms | 340 KB | Output isn't correct |
44 | Incorrect | 2 ms | 340 KB | Output isn't correct |
45 | Incorrect | 2 ms | 340 KB | Output isn't correct |
46 | Incorrect | 2 ms | 340 KB | Output isn't correct |
47 | Incorrect | 2 ms | 340 KB | Output isn't correct |