# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
891968 |
2023-12-24T14:00:32 Z |
Macker |
Archery (IOI09_archery) |
C++17 |
|
2000 ms |
6712 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
int main()
{
int n, r; cin >> n >> r;
int me; cin >> me;
vector<int> nv(2 * n - 1);
for (auto &i : nv) {
cin >> i;
}
nv.push_back(me);
int mnp = -1;
int mns = INT_MAX;
for (int i = 2 * n - 1; i > 0; i--) {
int mn = 0, mx = INT_MAX;
vector<int> v = nv;
int p = r;
while(mn < mx){
mn = INT_MAX;
mx = 0;
for (int j = 1; j < n; j++) {
mn = min(mn, max(v[2 * j], v[2 * j + 1]));
mx = max(mx, min(v[2 * j], v[2 * j + 1]));
}
if(v[0] != 1) mn = 0;
if(mn > mx) break;
vector<int> tv(2 * n);
if(v[0] > v[1]) swap(v[0], v[1]);
tv[0] = v[0];
tv[2 * n - 1] = v[1];
for (int j = 1; j < n; j++) {
int& s = v[2 * j], &b = v[2 * j + 1];
if(s < b) swap(s, b);
tv[2 * j] = s;
tv[2 * j - 1] = b;
}
v = tv;
p--;
}
if(me > n || me == 1) p = 0;
for (int j = 0; j < 2 * n; j++) {
if(v[j] == me){
if((j / 2 - p + p * n) % n < mns){
mns = (j / 2 - p + p * n) % n;
mnp = i / 2 + 1;
}
break;
}
}
swap(nv[i], nv[i - 1]);
}
cout << mnp << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Execution timed out |
2087 ms |
348 KB |
Time limit exceeded |
3 |
Correct |
25 ms |
348 KB |
Output is correct |
4 |
Execution timed out |
2004 ms |
344 KB |
Time limit exceeded |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
207 ms |
424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
344 KB |
Output is correct |
2 |
Incorrect |
221 ms |
348 KB |
Output isn't correct |
3 |
Execution timed out |
2054 ms |
604 KB |
Time limit exceeded |
4 |
Execution timed out |
2049 ms |
860 KB |
Time limit exceeded |
5 |
Execution timed out |
2005 ms |
5840 KB |
Time limit exceeded |
6 |
Correct |
169 ms |
348 KB |
Output is correct |
7 |
Execution timed out |
2067 ms |
348 KB |
Time limit exceeded |
8 |
Execution timed out |
2045 ms |
860 KB |
Time limit exceeded |
9 |
Execution timed out |
2037 ms |
952 KB |
Time limit exceeded |
10 |
Execution timed out |
2051 ms |
348 KB |
Time limit exceeded |
11 |
Execution timed out |
2061 ms |
940 KB |
Time limit exceeded |
12 |
Execution timed out |
2049 ms |
344 KB |
Time limit exceeded |
13 |
Execution timed out |
2043 ms |
4488 KB |
Time limit exceeded |
14 |
Execution timed out |
2072 ms |
348 KB |
Time limit exceeded |
15 |
Execution timed out |
2065 ms |
1376 KB |
Time limit exceeded |
16 |
Correct |
213 ms |
344 KB |
Output is correct |
17 |
Execution timed out |
2055 ms |
348 KB |
Time limit exceeded |
18 |
Execution timed out |
2052 ms |
344 KB |
Time limit exceeded |
19 |
Execution timed out |
2039 ms |
796 KB |
Time limit exceeded |
20 |
Execution timed out |
2061 ms |
604 KB |
Time limit exceeded |
21 |
Execution timed out |
2029 ms |
948 KB |
Time limit exceeded |
22 |
Execution timed out |
2039 ms |
1388 KB |
Time limit exceeded |
23 |
Execution timed out |
2017 ms |
6308 KB |
Time limit exceeded |
24 |
Correct |
228 ms |
420 KB |
Output is correct |
25 |
Execution timed out |
2063 ms |
348 KB |
Time limit exceeded |
26 |
Execution timed out |
2055 ms |
348 KB |
Time limit exceeded |
27 |
Execution timed out |
2055 ms |
948 KB |
Time limit exceeded |
28 |
Execution timed out |
2025 ms |
4460 KB |
Time limit exceeded |
29 |
Execution timed out |
2021 ms |
348 KB |
Time limit exceeded |
30 |
Execution timed out |
2055 ms |
344 KB |
Time limit exceeded |
31 |
Execution timed out |
2033 ms |
952 KB |
Time limit exceeded |
32 |
Execution timed out |
2056 ms |
6072 KB |
Time limit exceeded |
33 |
Correct |
212 ms |
344 KB |
Output is correct |
34 |
Correct |
219 ms |
420 KB |
Output is correct |
35 |
Execution timed out |
2079 ms |
344 KB |
Time limit exceeded |
36 |
Execution timed out |
2074 ms |
344 KB |
Time limit exceeded |
37 |
Execution timed out |
2040 ms |
976 KB |
Time limit exceeded |
38 |
Execution timed out |
2028 ms |
1172 KB |
Time limit exceeded |
39 |
Correct |
185 ms |
348 KB |
Output is correct |
40 |
Execution timed out |
2029 ms |
344 KB |
Time limit exceeded |
41 |
Execution timed out |
2037 ms |
344 KB |
Time limit exceeded |
42 |
Execution timed out |
2021 ms |
344 KB |
Time limit exceeded |
43 |
Execution timed out |
2049 ms |
348 KB |
Time limit exceeded |
44 |
Execution timed out |
2066 ms |
768 KB |
Time limit exceeded |
45 |
Execution timed out |
2041 ms |
952 KB |
Time limit exceeded |
46 |
Execution timed out |
2079 ms |
1200 KB |
Time limit exceeded |
47 |
Execution timed out |
2057 ms |
6712 KB |
Time limit exceeded |