This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// ioi 2014
// Day 1: Rail
#include <bits/stdc++.h>
#include "rail.h"
using namespace std;
void findLocation(int N, int first, int location[], int stype[])
{
// we always know the type and location of the first station
location[0] = first;
stype[0] = 1;
vector<int> dist; // distance from 0
int closest = INT_MAX;
int station = 0;
dist.push_back(0);
for (int i = 1; i < N; i++)
{
int d = getDistance(0, i);
if (d < closest) {
station = i;
closest = d;
}
dist.push_back(d);
}
closest += first;
stype[station] = 2;
location[station] = closest;
for (int i = 1; i < N; i++)
{
if (i == station) {
continue;
}
int d = getDistance(station, i);
if (d < dist[i])
{
stype[i] = 1;
location[i] = closest - d;
}
else
{
stype[i] = 2;
location[i] = first + dist[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... |