Submission #532603

#TimeUsernameProblemLanguageResultExecution timeMemory
532603cig32Jousting tournament (IOI12_tournament)C++17
17 / 100
1089 ms1544 KiB
#include "bits/stdc++.h" #include <stdio.h> #include <stdlib.h> #include <assert.h> using namespace std; const int MOD = 1e9 + 7; mt19937_64 rng((int)std::chrono::steady_clock::now().time_since_epoch().count()); int rnd(int x, int y) { int u = uniform_int_distribution<int>(x, y)(rng); return u; } #define inbuf_len 1 << 16 #define outbuf_len 1 << 16 int GetBestPosition(int N, int C, int R, int *K, int *S, int *E); #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 = 0; 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:40:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |       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...