# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
282800 | Ozy | Rail (IOI14_rail) | C++17 | 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-templates\rail.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
void findLocation(int N, int first, int location[], int stype[])
{
int prim,pos,dis,MIN,a,b;
MIN = -1;
rep(i,1,N-1) {
dis = getDistance(N,i);
if (MIN == -1 || dis < MIN) {
MIN = dis;
pos = first + dis;
prim = i;
}
}
location[N] = first;
location[prim] = pos;
stype[N] = 'C';
stype[prim] = 'D';
rep(i,1,N-1) {
if (i != prim) {
a = getDistance(N,i);
b = getDistance(prim,i);
if (a < b) {
location[i] = first + a;
stype[i] = 'D';
}
else {
location[i] = pos - b;
stype[i] = 'C';
}
}
}
}