# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
135233 | arthurconmy | 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 <bits/stdc++.h>
#ifndef ARTHUR_LOCAL
#include "rail.h"
#endif
using namespace std;
int dis[2][100];
void findLocation(int n, int first, int location[], int stype[])
{
location[0]=first;
stype[0]=1;
pair<int,int> ming = {int(1e9),int(1e9)};
for(int i=1; i<n; i++)
{
int cur_dis = getDistance(0,i)
dis[0][i]=cur_dis;
ming = min(ming,{cur_dis,i});
}
location[ming.second]=first+ming.first;
stype[ming.second]=2;
for(int i=1; i<n; i++)
{
dis[1][i] = getDistance(ming.second,i);
}
for(int i=1; i<n; i++)
{
if(i==ming.second) continue;
if(dis[0][i] < dis[1][i])
{
stype[i]=2;
location[i] = location[0] + dis[0][i];
}
else
{
stype[i]=1;
location[i] = location[ming.second] - dis[1][i];
}
}
}