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"
#define debug(args...) fprintf(stderr, args)
const int maxn = 5e5, INF = 1e9;
int d[maxn], r[maxn], mn, id;
void findLocation(int N, int first, int location[], int stype[])
{
mn = INF;
for(int x = 1; x < N; x++)
d[x] = getDistance(0, x);
for(int x = 1; x < N; x++)
if(d[x] < mn)
{
mn = d[x];
id = x;
}
location[0] = first;
stype[0] = 1;
location[id] = first+d[id];
stype[id] = 2;
for(int x = 1; x < N; x++)
r[x] = getDistance(id, x);
for(int x = 1; x < N; x++)
{
if(x == id) continue;
if(d[x] < r[x])
{
location[x] = first+d[x];
stype[x] = 2;
}
else
{
location[x] = d[id]-r[x];
stype[x] = 1;
}
}
}
# | 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... |