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;
for(int i = 1 ; i < N ; i++)
{
int d = getDistance(0 , i);
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)
continue;
int d = getDistance(0 , i);
int pi = 2 * pm - p0 - d;
if(pi < p0 && pi >= 0 && pi != pm)
{
location[i] = pi;
stype[i] = 1;
}
else
{
location[i] = getDistance(0 , i) + p0;
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... |