# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
429158 | _ani | Rail (IOI14_rail) | C++17 | 95 ms | 500 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 <algorithm>
void findLocation(int N, int first, int location[], int stype[])
{
location[0] = first;
stype[0] = 1;
int mi = 500002, mii;
for (int i = 1; i < N; i++)
{
int dist = getDistance(0, i);
if (dist < mi)
{
mi = dist;
mii = i;
}
}
location[mii] = first + mi;
stype[mii] = 2;
for (int i = 1; i < N; i++)
if (i != mii)
{
int dist = getDistance(i, mii);
if (dist == getDistance(i, 0) + mi)
{
location[i] = first + getDistance(0, i);
stype[i] = 2;
}
else
{
location[i] = mii - getDistance(mii, i);
stype[i] = 1;
}
}
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |