#include "rail.h"
#include <bits/stdc++.h>
using namespace std;
void findLocation(int n, int first, int location[], int stype[]) {
location[0] = first;
stype[0] = 1;
int dist[n] = {0};
dist[0] = 0;
int mdn = 0;
int mn = INT_MAX;
for (int i = 1;i < n;i++) {
dist[i] = getDistance(0, i);
if (dist[i] < mn) {
mn = dist[i];
mdn = i;
}
}
for (int i = 1;i < n;i++) {
if (i == mdn) {
stype[i] = 2;
location[i] = first + dist[i];
continue;
}
if (dist[mdn] + getDistance(mdn, i) == dist[i]) {
stype[i] = 1;
location[i] = first + dist[mdn] - getDistance(mdn, i);
continue;
}
stype[i] = 2;
location[i] = first + dist[i];
}
}