Submission #946055

# Submission time Handle Problem Language Result Execution time Memory
946055 2024-03-14T09:53:11 Z thelegendary08 Jousting tournament (IOI12_tournament) C++14
Compilation error
0 ms 0 KB
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {
    vector<int>v;
    for(int u : K)v.push_back(u);
    int ans = 0;
    for(int i = 0;i<N;i++){
        int cur = 0;
        vector<int>w = v;
        w.insert(v.begin() + i, R);
        for(int j = 0;j<C;j++){
            int mx = *max_element(w.begin() + S[j], w.begin() + E[j]);
            if(mx == R)cur++;
            for(int k = S[j];k<=E[j];k++){
                if(w[k] != mx)w.erase(w.begin() + k);
            }
        }
        ans = max(ans, cur);
    }
    return ans;



}

Compilation message

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>v;
      |     ^~~~~~
tournament.cpp:3:12: error: expected primary-expression before 'int'
    3 |     vector<int>v;
      |            ^~~
tournament.cpp:4:17: error: 'begin' was not declared in this scope
    4 |     for(int u : K)v.push_back(u);
      |                 ^
tournament.cpp:4:17: error: 'end' was not declared in this scope
tournament.cpp:4:19: error: 'v' was not declared in this scope
    4 |     for(int u : K)v.push_back(u);
      |                   ^
tournament.cpp:8:16: error: expected primary-expression before 'int'
    8 |         vector<int>w = v;
      |                ^~~
tournament.cpp:9:9: error: 'w' was not declared in this scope
    9 |         w.insert(v.begin() + i, R);
      |         ^
tournament.cpp:9:18: error: 'v' was not declared in this scope
    9 |         w.insert(v.begin() + i, R);
      |                  ^
tournament.cpp:11:23: error: 'max_element' was not declared in this scope
   11 |             int mx = *max_element(w.begin() + S[j], w.begin() + E[j]);
      |                       ^~~~~~~~~~~
tournament.cpp:17:15: error: 'max' was not declared in this scope
   17 |         ans = max(ans, cur);
      |               ^~~