# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
891955 |
2023-12-24T13:55:21 Z |
Macker |
Archery (IOI09_archery) |
C++17 |
|
2000 ms |
7068 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) 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 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Execution timed out |
2083 ms |
348 KB |
Time limit exceeded |
3 |
Correct |
6 ms |
344 KB |
Output is correct |
4 |
Execution timed out |
2052 ms |
472 KB |
Time limit exceeded |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
43 ms |
420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
45 ms |
440 KB |
Output isn't correct |
3 |
Execution timed out |
2070 ms |
600 KB |
Time limit exceeded |
4 |
Execution timed out |
2037 ms |
984 KB |
Time limit exceeded |
5 |
Execution timed out |
2086 ms |
5656 KB |
Time limit exceeded |
6 |
Correct |
34 ms |
348 KB |
Output is correct |
7 |
Execution timed out |
2001 ms |
344 KB |
Time limit exceeded |
8 |
Execution timed out |
2103 ms |
1092 KB |
Time limit exceeded |
9 |
Execution timed out |
2040 ms |
1168 KB |
Time limit exceeded |
10 |
Execution timed out |
2067 ms |
348 KB |
Time limit exceeded |
11 |
Execution timed out |
2027 ms |
1164 KB |
Time limit exceeded |
12 |
Execution timed out |
2052 ms |
348 KB |
Time limit exceeded |
13 |
Execution timed out |
2007 ms |
4116 KB |
Time limit exceeded |
14 |
Execution timed out |
2058 ms |
604 KB |
Time limit exceeded |
15 |
Execution timed out |
2017 ms |
1372 KB |
Time limit exceeded |
16 |
Correct |
40 ms |
348 KB |
Output is correct |
17 |
Execution timed out |
2065 ms |
600 KB |
Time limit exceeded |
18 |
Execution timed out |
2071 ms |
348 KB |
Time limit exceeded |
19 |
Execution timed out |
2037 ms |
344 KB |
Time limit exceeded |
20 |
Execution timed out |
2025 ms |
344 KB |
Time limit exceeded |
21 |
Execution timed out |
2025 ms |
1164 KB |
Time limit exceeded |
22 |
Execution timed out |
2013 ms |
1384 KB |
Time limit exceeded |
23 |
Execution timed out |
2033 ms |
7068 KB |
Time limit exceeded |
24 |
Correct |
47 ms |
348 KB |
Output is correct |
25 |
Execution timed out |
2017 ms |
344 KB |
Time limit exceeded |
26 |
Execution timed out |
2027 ms |
344 KB |
Time limit exceeded |
27 |
Execution timed out |
2091 ms |
1152 KB |
Time limit exceeded |
28 |
Execution timed out |
2045 ms |
4384 KB |
Time limit exceeded |
29 |
Execution timed out |
2064 ms |
348 KB |
Time limit exceeded |
30 |
Execution timed out |
2070 ms |
348 KB |
Time limit exceeded |
31 |
Execution timed out |
2021 ms |
1116 KB |
Time limit exceeded |
32 |
Execution timed out |
2036 ms |
6440 KB |
Time limit exceeded |
33 |
Correct |
43 ms |
348 KB |
Output is correct |
34 |
Correct |
42 ms |
420 KB |
Output is correct |
35 |
Execution timed out |
2052 ms |
348 KB |
Time limit exceeded |
36 |
Execution timed out |
2017 ms |
344 KB |
Time limit exceeded |
37 |
Execution timed out |
2041 ms |
1256 KB |
Time limit exceeded |
38 |
Execution timed out |
2041 ms |
1420 KB |
Time limit exceeded |
39 |
Correct |
35 ms |
348 KB |
Output is correct |
40 |
Execution timed out |
2076 ms |
444 KB |
Time limit exceeded |
41 |
Execution timed out |
2062 ms |
348 KB |
Time limit exceeded |
42 |
Execution timed out |
2057 ms |
348 KB |
Time limit exceeded |
43 |
Execution timed out |
2047 ms |
348 KB |
Time limit exceeded |
44 |
Execution timed out |
2065 ms |
944 KB |
Time limit exceeded |
45 |
Execution timed out |
2057 ms |
1288 KB |
Time limit exceeded |
46 |
Execution timed out |
2033 ms |
1200 KB |
Time limit exceeded |
47 |
Execution timed out |
2057 ms |
6568 KB |
Time limit exceeded |