제출 #242324

#제출 시각아이디문제언어결과실행 시간메모리
242324jamielim마상시합 토너먼트 (IOI12_tournament)C++14
17 / 100
1097 ms1024 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> ii;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()

int GetBestPosition(int N, int C, int R, int *K, int *S, int *E){
	int maxi=0,ans=0;
	for(int p=0;p<N;p++){
		int cur=0;
		int arr[N];arr[p]=R;
		for(int i=0;i<N;i++){
			if(i<p)arr[i]=K[i];
			else if(i>p)arr[i]=K[i-1];
		}
		for(int i=0;i<C;i++){
			int m=0;
			for(int j=S[i];j<=E[i];j++){
				m=max(m,arr[j]);
			}
			arr[S[i]]=m;
			if(m==R)cur++;
			for(int j=S[i]+1;j<N-E[i]+S[i];j++){
				arr[j]=arr[j+E[i]-S[i]];
			}
		}
		if(cur>maxi){maxi=cur;ans=p;}
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...