이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |