# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
583285 | Jomnoi | Jousting tournament (IOI12_tournament) | C++17 | 1089 ms | 2712 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {
int max_win = -1, best_pos = 0;
for(int p = 0; p < N; p++) {
vector <pair <int, int>> order;
int j = 0;
for(int i = 0; i < p; i++) {
order.emplace_back(K[j++], i);
}
order.emplace_back(R, p);
while(j < N - 1) {
order.emplace_back(K[j++], j + 1);
}
int cnt_win = 0;
for(int c = 0; c < C; c++) {
int op = 0;
for(int i = S[c]; i <= E[c]; i++) {
op = max(op, order[i].first);
}
vector <pair <int, int>> tmp;
for(int i = 0; i < S[c]; i++) {
tmp.push_back(order[i]);
}
for(int i = S[c]; i <= E[c]; i++) {
if(op == order[i].first) {
if(order[i].second == p) {
cnt_win++;
}
tmp.push_back(order[i]);
}
}
for(int i = E[c] + 1; i < order.size(); i++) {
tmp.push_back(order[i]);
}
}
if(max_win < cnt_win) {
max_win = cnt_win;
best_pos = p;
}
}
return best_pos;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |