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;
const int maxN = 5e3 + 20;
int distX[maxN];
int distY[maxN];
int distZ[maxN];
void findLocation(int N, int first, int location[], int stype[]) {
for (int i = 0; i < N; i++) {
location[i] = -1;
stype[i] = -1;
}
int X = 0;
location[X] = first;
stype[X] = 1;
for (int i = 0; i < N; i++) {
if (i != X) {
distX[i] = getDistance(X, i);
}
}
int Y = 1;
for (int i = 0; i < N; i++) {
if (i != X && distX[i] < distX[Y]) {
Y = i;
}
}
location[Y] = location[X] + distX[Y];
stype[Y] = 2;
for (int i = 0; i < N; i++) {
if (i != Y) {
distY[i] = getDistance(Y, i);
}
}
for (int i = 0; i < N; i++) {
if (i == X || i == Y) {
continue;
}
if (distX[i] == distX[Y] + distY[i]) {
location[i] = location[Y] - distY[i];
stype[i] = 1;
}
if (distY[i] == distY[X] + distX[i]) {
location[i] = location[X] + distX[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... |