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 "rail.h"
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll i,x[5050],cal;
void findLocation(int N, int first, int location[], int stype[])
{
//if(N>100)
// while(1);
location[0]=first;
stype[0]=1;
if(N==1)
return ;
ll cal=1;
for(i=1;i<N;i++)
{
x[i]=getDistance(0,i);
if(x[i]<x[cal])
cal=i;
// cout<<i<<" "<<location[i]<<" "<<stype[i]<<"\n";
}
location[cal]=location[0]+x[cal];
stype[cal]=2;
//cout<<cal<<"cal\n";
for(i=1;i<N;i++)
{
if(cal==i)continue;
if(getDistance(cal,i)>x[i])
{
location[i]=location[0]+x[i];
stype[i]=2;
}
else
{
location[i]=location[cal]-getDistance(cal,i);
stype[i]=1;
}
}
// for(i=0;i<N;i++)
// cout<<i<<" "<<stype[i]<<" "<<location[i]<<"\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |