# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100509 | figter001 | Jousting tournament (IOI12_tournament) | C++17 | 1069 ms | 2228 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.
// #include "grader.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {
vector<int> r,tmp,nxt;
for(int i=0;i<N-1;i++){
r.push_back(K[i]);
}
int ans = 0;
for(int i=0;i<N ;i++){
int cur = 0;
tmp = r;
tmp.insert(tmp.begin() + i,R);
for(int j=0;j<C;j++){
nxt.clear();
int l = S[j];
int r = E[j];
int mx = -1;
for(int x=0;x<tmp.size();x++){
if(x >= l && x <= r){
mx = max(mx,tmp[x]);
}else{
if(x == r + 1){
nxt.push_back(mx);
if(mx == R)
cur++;
mx = -1;
}
nxt.push_back(tmp[x]);
}
}
if(mx != -1){
nxt.push_back(mx);
if(mx == R)
cur++;
}
tmp = nxt;
}
ans = max(ans,cur);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |