Submission #592436

#TimeUsernameProblemLanguageResultExecution timeMemory
592436promaJousting tournament (IOI12_tournament)C++17
0 / 100
1083 ms2184 KiB
#include <bits/stdc++.h>
#define see(x) cerr<<#x<<"="<<x<<"\n";

using namespace std;

int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {
    vector <int> kn;
    int ans = 0;
    for (int i = 0; i < N; i ++) {
        for (int j = 0; j < i; j ++) kn.push_back(K[j]);
        kn.push_back(R);
        for (int j = i; j < N - 1; j ++) kn.push_back(K[j]);
        int cnt = 0;
        for (int j = 0; j < C; j ++) {
            int mx = -1;
            for (int k = S[j]; k <= E[j]; k ++) {
                mx = max(mx, kn[k]);
            }
            if (mx == R) cnt ++;
            vector <int> tmp;
            for (int k = 0; k < S[j]; k ++) tmp.push_back(kn[k]);
            tmp.push_back(mx);
            for (int k = E[j] + 1; k < kn.size(); k ++) tmp.push_back(kn[k]);
            kn.clear();
            for (auto i: tmp) kn.push_back(i);
        }
        ans = max(ans, cnt);
        kn.clear();
    }
    return ans;
}

Compilation message (stderr)

tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:23:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |             for (int k = E[j] + 1; k < kn.size(); k ++) tmp.push_back(kn[k]);
      |                                    ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...