# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
348463 | daniel920712 | Jousting tournament (IOI12_tournament) | C++14 | 1084 ms | 1132 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 <stdio.h>
#include <time.h>
#include <iostream>
#include <stdio.h>
#include <assert.h>
#include <vector>
using namespace std;
vector < int > all;
vector < int > ttt;
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E)
{
int ans=-1,where=-1,who,i,j,k,tt,big,how=0,con=0,x,y,z;
for(i=0;i<N;i++)
{
tt=0;
all.clear();
for(j=0;j<i;j++) all.push_back(K[j]);
all.push_back(R);
for(j=i;j<N-1;j++) all.push_back(K[j]);
x=-1;
y=2e9;
z=i;
for(j=0;j<N;j++)
{
//printf("%d ",all[j]);
if(all[j]>R)
{
if(j<i) x=max(x,j);
else y=min(y,j);
}
}
//printf("\n%d %d %d\n",x,y,z);
for(j=0;j<C;j++)
{
if(S[j]<=z&&E[j]>=z)
{
if(S[j]<=x||E[j]>=y) break;
else
{
tt++;
z=S[j];
y-=(E[j]-S[j]);
}
}
else if(E[j]<z)
{
if(S[j]<=x&&E[j]>=x)
{
x=S[j];
y-=(E[j]-S[j]);
z-=(E[j]-S[j]);
}
else if(x>E[j])
{
x-=(E[j]-S[j]);
y-=(E[j]-S[j]);
z-=(E[j]-S[j]);
}
else
{
y-=(E[j]-S[j]);
z-=(E[j]-S[j]);
}
}
else
{
if(S[j]<=y&&E[j]>=y) y=S[j];
else if(y>E[j]) y-=(E[j]-S[j]);
}
}
//printf("%d %d\n",i,tt);
if(tt>ans)
{
ans=tt;
where=i;
}
}
return where;
}
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... |