# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
125887 | zozder | 철로 (IOI14_rail) | 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.
#include "rail.h"
#include <iostream>
#include <cstdlib>
using namespace std;
int l[10000][2];//到0的路
int mnl;
int compare(const void *x , const void *y)
{
return ((int*)x)[1] - ((int*)y)[1];
}
int gD(int x, int y)
{
return getDistance(x,y);
}
void findLocation(int N, int first, int location[], int stype[])
{
location[0]=first;
stype[0]=1;
for(int i=1;i<N;i++)
{
l[i][0]=i;
l[i][1]=gD(0,i);
}
qsort(l+1,N-1,sizeof(int)*2,compare);
int p=1;
mnl=l[p][0];
p++;
while(p<N)
{
int a,b,c;
a=l[1][1];
b=l[p][1];
c=gD(mnl,l[p][0]);
if(a+b=c)
{
location
}
}
}