# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
891936 |
2023-12-24T13:28:18 Z |
Macker |
Archery (IOI09_archery) |
C++17 |
|
2000 ms |
8760 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;
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;
}
for (int j = 0; j < 2 * n; j++) {
if(v[j] == me){
if(j / 2 < mns){
mns = j / 2;
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 |
2080 ms |
348 KB |
Time limit exceeded |
3 |
Correct |
5 ms |
348 KB |
Output is correct |
4 |
Execution timed out |
2088 ms |
348 KB |
Time limit exceeded |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
40 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
42 ms |
348 KB |
Output isn't correct |
3 |
Execution timed out |
2063 ms |
500 KB |
Time limit exceeded |
4 |
Execution timed out |
2028 ms |
948 KB |
Time limit exceeded |
5 |
Execution timed out |
2047 ms |
6564 KB |
Time limit exceeded |
6 |
Correct |
31 ms |
344 KB |
Output is correct |
7 |
Execution timed out |
2072 ms |
348 KB |
Time limit exceeded |
8 |
Execution timed out |
2035 ms |
1100 KB |
Time limit exceeded |
9 |
Execution timed out |
2041 ms |
1200 KB |
Time limit exceeded |
10 |
Execution timed out |
2069 ms |
348 KB |
Time limit exceeded |
11 |
Execution timed out |
2050 ms |
1172 KB |
Time limit exceeded |
12 |
Execution timed out |
2058 ms |
348 KB |
Time limit exceeded |
13 |
Execution timed out |
2065 ms |
4748 KB |
Time limit exceeded |
14 |
Execution timed out |
2041 ms |
600 KB |
Time limit exceeded |
15 |
Execution timed out |
2062 ms |
1376 KB |
Time limit exceeded |
16 |
Incorrect |
40 ms |
348 KB |
Output isn't correct |
17 |
Execution timed out |
2027 ms |
344 KB |
Time limit exceeded |
18 |
Execution timed out |
2055 ms |
348 KB |
Time limit exceeded |
19 |
Execution timed out |
2040 ms |
348 KB |
Time limit exceeded |
20 |
Execution timed out |
2078 ms |
348 KB |
Time limit exceeded |
21 |
Execution timed out |
2064 ms |
1172 KB |
Time limit exceeded |
22 |
Execution timed out |
2049 ms |
1388 KB |
Time limit exceeded |
23 |
Execution timed out |
2033 ms |
6864 KB |
Time limit exceeded |
24 |
Correct |
57 ms |
348 KB |
Output is correct |
25 |
Execution timed out |
2047 ms |
600 KB |
Time limit exceeded |
26 |
Execution timed out |
2019 ms |
600 KB |
Time limit exceeded |
27 |
Execution timed out |
2040 ms |
1180 KB |
Time limit exceeded |
28 |
Execution timed out |
2068 ms |
5060 KB |
Time limit exceeded |
29 |
Execution timed out |
2047 ms |
348 KB |
Time limit exceeded |
30 |
Execution timed out |
2037 ms |
600 KB |
Time limit exceeded |
31 |
Execution timed out |
2054 ms |
1116 KB |
Time limit exceeded |
32 |
Execution timed out |
2037 ms |
6648 KB |
Time limit exceeded |
33 |
Correct |
44 ms |
344 KB |
Output is correct |
34 |
Correct |
44 ms |
344 KB |
Output is correct |
35 |
Execution timed out |
2075 ms |
348 KB |
Time limit exceeded |
36 |
Execution timed out |
2049 ms |
348 KB |
Time limit exceeded |
37 |
Execution timed out |
2067 ms |
1092 KB |
Time limit exceeded |
38 |
Execution timed out |
2065 ms |
1176 KB |
Time limit exceeded |
39 |
Correct |
35 ms |
348 KB |
Output is correct |
40 |
Execution timed out |
2064 ms |
348 KB |
Time limit exceeded |
41 |
Execution timed out |
2065 ms |
348 KB |
Time limit exceeded |
42 |
Execution timed out |
2072 ms |
348 KB |
Time limit exceeded |
43 |
Execution timed out |
2062 ms |
348 KB |
Time limit exceeded |
44 |
Execution timed out |
2017 ms |
1108 KB |
Time limit exceeded |
45 |
Execution timed out |
2064 ms |
1116 KB |
Time limit exceeded |
46 |
Execution timed out |
2059 ms |
1272 KB |
Time limit exceeded |
47 |
Execution timed out |
2065 ms |
8760 KB |
Time limit exceeded |