# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
242322 | jamielim | Jousting tournament (IOI12_tournament) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
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 maxi;
}