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;
void findLocation(int n, int first, int location[], int stype[]) {
location[0] = first;
stype[0] = 1;
vector<int> dist0(n);
int min_dist = 1e9, u = -1;
for (int i = 1; i < n; ++i) {
dist0[i] = getDistance(0, i);
if (dist0[i] < min_dist) {
min_dist = dist0[i];
u = i;
}
}
stype[u] = 2;
location[u] = location[0]+min_dist;
for (int i = 1; i < n; ++i) {
if (i == u) continue;
int d = getDistance(u, i);
if (d > dist0[i]) {
stype[i] = 2;
location[i] = location[0]+dist0[i];
} else {
stype[i] = 1;
location[i] = location[u]-d;
}
}
}
# | 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... |