Submission #946046

#TimeUsernameProblemLanguageResultExecution timeMemory
946046itslqJousting tournament (IOI12_tournament)C++17
Compilation error
0 ms0 KiB
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])); knights.insert(next(knights.begin(), S[j]), M); if (M == R) X++; } if (X > ans) { ans = X; ansind = i; } } return ansind; }

Compilation message (stderr)

tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:3:5: error: 'vector' was not declared in this scope
    3 |     vector<int> remaining;
      |     ^~~~~~
tournament.cpp:3:12: error: expected primary-expression before 'int'
    3 |     vector<int> remaining;
      |            ^~~
tournament.cpp:4:33: error: 'remaining' was not declared in this scope
    4 |     for (int i = 0; i < N; i++) remaining.push_back(K[i]);
      |                                 ^~~~~~~~~
tournament.cpp:8:16: error: expected primary-expression before 'int'
    8 |         vector<int> knights = remaining;
      |                ^~~
tournament.cpp:9:9: error: 'knights' was not declared in this scope
    9 |         knights.insert(next(knights.begin(), i), R);
      |         ^~~~~~~
tournament.cpp:9:24: error: 'next' was not declared in this scope
    9 |         knights.insert(next(knights.begin(), i), R);
      |                        ^~~~
tournament.cpp:13:52: error: 'max' was not declared in this scope
   13 |             for (int k = S[j]; k <= E[j]; k++) M = max(M, knights[k]);
      |                                                    ^~~