Submission #532600

#TimeUsernameProblemLanguageResultExecution timeMemory
532600cig32Jousting tournament (IOI12_tournament)C++17
0 / 100
1093 ms1560 KiB
#include "bits/stdc++.h" using namespace std; const int MAXN = 1e5 + 10; int st[17][MAXN]; int query(int l, int r) { int k = 32 - __builtin_clz(r-l+1) - 1; return max(st[k][l], st[k][r - (1<<k) + 1]); } int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { int opt_cnt = 0, opt_id = -1; for(int P=0; P<N; P++) { vector<int> now; for(int j=0; j<P; j++) now.push_back(K[j]); now.push_back(R); for(int j=P; j<N; j++) now.push_back(K[j]); int res = 0; for(int i=0; i<C; i++) { int mx = 0; for(int j=S[i]; j<=E[i]; j++) { mx = max(mx, now[j]); } vector<int> rep; for(int j=0; j<S[i]; j++) rep.push_back(now[j]); rep.push_back(mx); for(int j=E[i]+1; j<now.size(); j++) rep.push_back(now[j]); now = rep; if(mx == R) res++; } if(res > opt_cnt) { opt_cnt = res, opt_id = P; } } return opt_id; }

Compilation message (stderr)

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