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>
#include "rail.h"
using namespace std;
int distFrom0[20000];
int distFromMin[20000];
void findLocation(int n, int first, int location[], int sType[]) {
location[0] = first;
sType[0] = 1;
int minDist = 1000000007;
int minIndex = -1;
for (int i = 1; i < n; i++)
{
distFrom0[i] = getDistance(0, i);
if (distFrom0[i] < minDist)
{
minDist = distFrom0[i];
minIndex = i;
}
}
location[minIndex] = distFrom0[minIndex] + first;
sType[minIndex] = 2;
for (int i = 0; i < n; i++)
{
if (i != 0 and i != minIndex)
{
distFromMin[i] = getDistance(minIndex, i);
if (distFromMin[i] > distFrom0[i])
{
sType[i] = 2;
location[i] = location[first] + distFrom0[i];
}
else
{
sType[i] = 1;
location[i] = location[minIndex] - distFromMin[i];
}
}
}
}
# | 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... |