Submission #946067

# Submission time Handle Problem Language Result Execution time Memory
946067 2024-03-14T09:55:10 Z itslq Jousting tournament (IOI12_tournament) C++17
17 / 100
1000 ms 1492 KB
#include <bits/stdc++.h>
using namespace std;

int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {
    int M, X, ans = 0, ansind = 0;
    vector<int> remaining;
    for (int i = 0; i < N; i++) remaining.push_back(K[i]);

    for (int i = 0; i < N; i++) {
        X = 0;
        vector<int> knights = remaining;
        knights.insert(next(knights.begin(), i), R);

        for (int j = 0; j < C; j++) {
            M = 0;
            for (int k = S[j]; k <= E[j]; k++) M = max(M, knights[k]);
            knights.erase(next(knights.begin(), S[j]), next(knights.begin(), E[j] + 1));
            knights.insert(next(knights.begin(), S[j]), M);
            if (M == R) X++;
        }

        if (X > ans) {
            ans = X;
            ansind = i;
        }
    }

    return ansind;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 6 ms 348 KB Output is correct
4 Correct 6 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 7 ms 456 KB Output is correct
7 Correct 6 ms 344 KB Output is correct
8 Correct 7 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 348 KB Output is correct
2 Execution timed out 1060 ms 348 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1036 ms 1492 KB Time limit exceeded
2 Halted 0 ms 0 KB -