# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
64683 | Vahan | Jousting tournament (IOI12_tournament) | C++17 | 1089 ms | 120908 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<vector>
using namespace std;
vector<int> g[5000000];
int a[5000000],o=-1,f;
void hetqc(int x,int y,int nn)
{
for(int i=y;i<nn;i++)
a[i]=a[i-y+x];
}
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E)
{
int n=N;
int t=n;
for(int i=0;i<n;i++)
a[i]=i;
int nn=n;
for(int i=0;i<C;i++)
{
for(int j=S[i];j<=E[i];j++)
g[t].push_back(a[j]);
a[S[i]]=t;
t++;
nn-=E[i]-S[i];
hetqc(E[i]+1,S[i]+1,nn);
}
for(int i=0;i<n;i++)
{
int e=0;
for(int j=0;j<n;j++)
{
if(i==j)
{
a[j]=R;
e=1;
}
else if(e==0)
a[j]=K[j];
else
a[j]=K[j-1];
}
int q=0;
for(int j=n;j<t;j++)
a[j]=-1;
for(int j=n;j<t;j++)
{
for(int e=0;e<g[j].size();e++)
a[j]=max(a[j],a[g[j][e]]);
if(a[j]==R)
q++;
}
if(q>o)
{
o=q;
f=i;
}
}
return f;
}
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... |