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<bits/stdc++.h>
using namespace std;
void findLocation(int N, int p0, int location[], int stype[])
{
int mn = 1e9;
int pm = 0;
int im = 0;
location[0] = p0;
stype[0] = 1;
vector<int> d1(N) , d2(N);
for(int i = 1 ; i < N ; i++)
{
int d = getDistance(0 , i);
d1[i] = d;
if(mn > d)
{
mn = d;
pm = d + p0;
im = i;
}
}
location[im] = pm;
stype[im] = 2;
for(int i = 1 ; i < N ; i++)
{
if(i != im)
{
d2[i] = getDistance(im , i);
}
}
for(int i = 1 ;i < N ; i++)
{
if(i != im)
{
if(d1[i] - d2[i] == mn)
{
location[i] = pm - d2[i];
stype[i] = 1;
}
else
{
location[i] = p0 + d1[i];
stype[i] = 2;
}
}
}
}
# | 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... |