Submission #1068013

# Submission time Handle Problem Language Result Execution time Memory
1068013 2024-08-21T06:40:25 Z Plurm Archery (IOI09_archery) C++11
10 / 100
2000 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;

int n, r;
map<vector<int>, int> timestamp;
int t;
void one_round(vector<int> &archers) {
    timestamp[archers] = t++;
    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) {
    timestamp.clear();
    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 2093 ms 35828 KB Time limit exceeded
3 Execution timed out 2077 ms 604 KB Time limit exceeded
4 Runtime error 51 ms 65536 KB Execution killed with signal 9
5 Correct 2 ms 344 KB Output is correct
6 Execution timed out 2098 ms 860 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 6 ms 348 KB Output is correct
2 Execution timed out 2086 ms 1116 KB Time limit exceeded
3 Execution timed out 2041 ms 31832 KB Time limit exceeded
4 Runtime error 41 ms 65536 KB Execution killed with signal 9
5 Runtime error 60 ms 65536 KB Execution killed with signal 9
6 Execution timed out 2101 ms 860 KB Time limit exceeded
7 Execution timed out 2070 ms 13472 KB Time limit exceeded
8 Runtime error 44 ms 65536 KB Execution killed with signal 9
9 Runtime error 63 ms 65536 KB Execution killed with signal 9
10 Execution timed out 2061 ms 20312 KB Time limit exceeded
11 Runtime error 53 ms 65536 KB Execution killed with signal 9
12 Runtime error 47 ms 65536 KB Execution killed with signal 9
13 Runtime error 58 ms 65536 KB Execution killed with signal 9
14 Runtime error 54 ms 65536 KB Execution killed with signal 9
15 Runtime error 69 ms 65536 KB Execution killed with signal 9
16 Correct 258 ms 1084 KB Output is correct
17 Execution timed out 2056 ms 26972 KB Time limit exceeded
18 Execution timed out 2052 ms 63824 KB Time limit exceeded
19 Runtime error 39 ms 65536 KB Execution killed with signal 9
20 Runtime error 59 ms 65536 KB Execution killed with signal 9
21 Runtime error 46 ms 65536 KB Execution killed with signal 9
22 Runtime error 65 ms 65536 KB Execution killed with signal 9
23 Runtime error 62 ms 65536 KB Execution killed with signal 9
24 Correct 110 ms 1116 KB Output is correct
25 Execution timed out 2078 ms 16484 KB Time limit exceeded
26 Runtime error 42 ms 65536 KB Execution killed with signal 9
27 Runtime error 56 ms 65536 KB Execution killed with signal 9
28 Runtime error 56 ms 65536 KB Execution killed with signal 9
29 Execution timed out 2091 ms 35676 KB Time limit exceeded
30 Runtime error 40 ms 65536 KB Execution killed with signal 9
31 Runtime error 52 ms 65536 KB Execution killed with signal 9
32 Runtime error 64 ms 65536 KB Execution killed with signal 9
33 Correct 199 ms 1112 KB Output is correct
34 Execution timed out 2049 ms 1088 KB Time limit exceeded
35 Runtime error 43 ms 65536 KB Execution killed with signal 9
36 Runtime error 51 ms 65536 KB Execution killed with signal 9
37 Runtime error 41 ms 65536 KB Execution killed with signal 9
38 Runtime error 68 ms 65536 KB Execution killed with signal 9
39 Execution timed out 2090 ms 1208 KB Time limit exceeded
40 Execution timed out 2051 ms 16216 KB Time limit exceeded
41 Runtime error 46 ms 65536 KB Execution killed with signal 9
42 Runtime error 43 ms 65536 KB Execution killed with signal 9
43 Runtime error 60 ms 65536 KB Execution killed with signal 9
44 Runtime error 55 ms 65536 KB Execution killed with signal 9
45 Runtime error 41 ms 65536 KB Execution killed with signal 9
46 Runtime error 62 ms 65536 KB Execution killed with signal 9
47 Runtime error 74 ms 65536 KB Execution killed with signal 9