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;
#ifdef B01
#include "../deb.h"
#else
#define deb(...)
#endif
void findLocation(int n, int p, int location[], int stype[]) {
vector<int> d(n);
for (int i = 1; i < n; i++) {
d[i] = getDistance(0, i);
}
int to = (int) (min_element(d.begin() + 1, d.end()) - d.begin());
vector<int> dd(n);
dd[0] = d[to];
for (int i = 1; i < n; i++) {
if (i == to) {
continue;
}
dd[i] = getDistance(to, i);
}
location[0] = p;
stype[0] = 1;
location[to] = p + d[to];
stype[to] = 2;
for (int i = 1; i < n; i++) {
if (i == to) {
continue;
}
if (dd[i] == dd[0] + d[i]) {
location[i] = p + d[i];
stype[i] = 2;
} else {
location[i] = location[to] - dd[i];
stype[i] = 1;
}
}
}
# | 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... |