# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1068048 |
2024-08-21T06:56:09 Z |
Plurm |
Archery (IOI09_archery) |
C++11 |
|
2000 ms |
7120 KB |
#include <bits/stdc++.h>
using namespace std;
int n, r;
int t;
void one_round(vector<int> &archers) {
vector<int> narchers(archers.begin(), archers.end());
for (int i = 2; i <= n; i++) {
if (archers[2 * (i - 1)] < archers[2 * (i - 1) + 1]) {
narchers[2 * (i - 2) + 1] = archers[2 * (i - 1)];
narchers[2 * (i - 1)] = archers[2 * (i - 1) + 1];
} else {
narchers[2 * (i - 2) + 1] = archers[2 * (i - 1) + 1];
narchers[2 * (i - 1)] = archers[2 * (i - 1)];
}
}
if (archers[0] < archers[1]) {
narchers[2 * (n - 1) + 1] = archers[1];
narchers[0] = archers[0];
} else {
narchers[2 * (n - 1) + 1] = archers[0];
narchers[0] = archers[1];
}
swap(archers, narchers);
}
void tournament(vector<int> &archers) {
r %= 2 * (n - 1) * n;
for (int i = 0; i < r; i++) {
one_round(archers);
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> r;
int me;
cin >> me;
vector<int> archers;
for (int i = 2; i <= 2 * n; i++) {
int x;
cin >> x;
archers.push_back(x);
}
int ans = -1;
int mn = 2 * n + 1;
for (int i = 0; i < 2 * n; i++) {
vector<int> tmp = archers;
tmp.insert(tmp.begin() + i, me);
tournament(tmp);
int ending = find(tmp.begin(), tmp.end(), me) - tmp.begin();
if (ending <= mn) {
mn = ending;
ans = i / 2 + 1;
}
}
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Execution timed out |
2078 ms |
348 KB |
Time limit exceeded |
3 |
Correct |
151 ms |
348 KB |
Output is correct |
4 |
Execution timed out |
2075 ms |
348 KB |
Time limit exceeded |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Execution timed out |
2084 ms |
348 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
460 KB |
Output is correct |
2 |
Execution timed out |
2088 ms |
348 KB |
Time limit exceeded |
3 |
Execution timed out |
2050 ms |
348 KB |
Time limit exceeded |
4 |
Execution timed out |
2086 ms |
996 KB |
Time limit exceeded |
5 |
Execution timed out |
2080 ms |
6600 KB |
Time limit exceeded |
6 |
Correct |
1095 ms |
348 KB |
Output is correct |
7 |
Execution timed out |
2044 ms |
460 KB |
Time limit exceeded |
8 |
Execution timed out |
2032 ms |
992 KB |
Time limit exceeded |
9 |
Execution timed out |
2011 ms |
1244 KB |
Time limit exceeded |
10 |
Execution timed out |
2041 ms |
344 KB |
Time limit exceeded |
11 |
Execution timed out |
2025 ms |
1244 KB |
Time limit exceeded |
12 |
Execution timed out |
2011 ms |
344 KB |
Time limit exceeded |
13 |
Execution timed out |
2069 ms |
4876 KB |
Time limit exceeded |
14 |
Execution timed out |
2040 ms |
600 KB |
Time limit exceeded |
15 |
Execution timed out |
2039 ms |
1508 KB |
Time limit exceeded |
16 |
Correct |
66 ms |
440 KB |
Output is correct |
17 |
Execution timed out |
2060 ms |
348 KB |
Time limit exceeded |
18 |
Execution timed out |
2080 ms |
344 KB |
Time limit exceeded |
19 |
Execution timed out |
2051 ms |
348 KB |
Time limit exceeded |
20 |
Execution timed out |
2070 ms |
604 KB |
Time limit exceeded |
21 |
Execution timed out |
2075 ms |
1248 KB |
Time limit exceeded |
22 |
Execution timed out |
2048 ms |
1516 KB |
Time limit exceeded |
23 |
Execution timed out |
2027 ms |
7120 KB |
Time limit exceeded |
24 |
Correct |
50 ms |
348 KB |
Output is correct |
25 |
Execution timed out |
2064 ms |
348 KB |
Time limit exceeded |
26 |
Execution timed out |
2085 ms |
604 KB |
Time limit exceeded |
27 |
Execution timed out |
2047 ms |
1248 KB |
Time limit exceeded |
28 |
Execution timed out |
2041 ms |
5076 KB |
Time limit exceeded |
29 |
Execution timed out |
2070 ms |
348 KB |
Time limit exceeded |
30 |
Execution timed out |
2048 ms |
604 KB |
Time limit exceeded |
31 |
Execution timed out |
2057 ms |
1248 KB |
Time limit exceeded |
32 |
Execution timed out |
2031 ms |
6612 KB |
Time limit exceeded |
33 |
Correct |
53 ms |
348 KB |
Output is correct |
34 |
Execution timed out |
2037 ms |
344 KB |
Time limit exceeded |
35 |
Execution timed out |
2039 ms |
348 KB |
Time limit exceeded |
36 |
Execution timed out |
2053 ms |
348 KB |
Time limit exceeded |
37 |
Execution timed out |
2061 ms |
1044 KB |
Time limit exceeded |
38 |
Execution timed out |
2017 ms |
1308 KB |
Time limit exceeded |
39 |
Correct |
1340 ms |
348 KB |
Output is correct |
40 |
Execution timed out |
2050 ms |
344 KB |
Time limit exceeded |
41 |
Execution timed out |
2061 ms |
348 KB |
Time limit exceeded |
42 |
Execution timed out |
2066 ms |
348 KB |
Time limit exceeded |
43 |
Execution timed out |
2023 ms |
600 KB |
Time limit exceeded |
44 |
Execution timed out |
2025 ms |
856 KB |
Time limit exceeded |
45 |
Execution timed out |
2029 ms |
1244 KB |
Time limit exceeded |
46 |
Execution timed out |
2060 ms |
992 KB |
Time limit exceeded |
47 |
Execution timed out |
2052 ms |
6604 KB |
Time limit exceeded |