# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
139025 | muradeyn | Rail (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 "grader.h"
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
void findLocation(int N, int first, int location[], int stype[])
{
location[0] = first;
stype[0] = 1;
if (N == 1)return;
int mn = INT_MAX , in;
for (int i = 1;i<N;i++) {
int ret = getDistance(0 , i);
if (ret < mn) {
mn = ret;
in = i;
}
}
location[in] = first + mn;
stype[in] = 2;
for (int i = 1;i<N;i++) {
if (i == in)continue;
int ret = getDistance(0 , i);
int ret2 = getDistance(i , in);
if (ret < ret2) {
location[i] = first + ret;
stype[i] = 2;
}
else {
location[i] = first + mn - ret2;
stype[i] = 1;
}
}
}