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;
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E){
//cout<<K[0];
vector<int>v;
for(int i = 0;i<N-1;i++)v.push_back(K[i]);
int ans = 0;
for(int i = 0;i<N;i++){
int cur = 0;
vector<int>w = v;
if(i != N-1)w.insert(w.begin() + i, R);
else w.insert(w.end(), R);
for(int j = 0;j<C;j++){
int mx = *max_element(w.begin() + S[j], w.begin() + E[j]);
if(mx == R)cur++;
for(int k = S[j];k<=E[j];k++){
if(w[k] != mx)w.erase(w.begin() + k);
}
}
ans = max(ans, cur);
}
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... |