# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
946055 | thelegendary08 | 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) {
vector<int>v;
for(int u : K)v.push_back(u);
int ans = 0;
for(int i = 0;i<N;i++){
int cur = 0;
vector<int>w = v;
w.insert(v.begin() + i, 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;
}