This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |