Submission #100509

#TimeUsernameProblemLanguageResultExecution timeMemory
100509figter001Jousting tournament (IOI12_tournament)C++17
0 / 100
1069 ms2228 KiB
// #include "grader.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {
	vector<int> r,tmp,nxt;
	for(int i=0;i<N-1;i++){
		r.push_back(K[i]);
	}
	int ans = 0;
	for(int i=0;i<N ;i++){
		int cur = 0;
		tmp = r;
		tmp.insert(tmp.begin() + i,R);
		for(int j=0;j<C;j++){
			nxt.clear();
			int l = S[j];
			int r = E[j];
			int mx = -1;
			for(int x=0;x<tmp.size();x++){
				if(x >= l && x <= r){
					mx = max(mx,tmp[x]);
				}else{
					if(x == r + 1){
						nxt.push_back(mx);
						if(mx == R)
							cur++;
						mx = -1;
					}
					nxt.push_back(tmp[x]);
				}
			}
			if(mx != -1){
				nxt.push_back(mx);
				if(mx == R)
					cur++;
			}
			tmp = nxt;
		}
		ans = max(ans,cur);
	}
	return ans;
}

Compilation message (stderr)

tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:25:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int x=0;x<tmp.size();x++){
                ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...