# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1072401 | Zicrus | Towns (IOI15_towns) | C++17 | 12 ms | 976 KiB |
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 "towns.h"
using namespace std;
typedef long long ll;
int hubDistance(int n, int sub) {
ll a = 0, b = 0;
ll mxDist = 0;
for (int i = 1; i < n; i++) {
ll val = getDistance(0, i);
if (val > mxDist) {
mxDist = val;
a = i;
}
}
mxDist = 0;
for (int i = 1; i < n; i++) {
ll val = getDistance(a, i);
if (val > mxDist) {
mxDist = val;
b = i;
}
}
ll res = 1ll << 62ll;
for (int i = 0; i < n; i++) {
if (i == a || i == b) continue;
ll distA = getDistance(i, a);
ll distB = getDistance(i, b);
ll nw = (distA + distB - mxDist) / 2;
distA -= nw;
distB -= nw;
ll val = max(distA, distB);
res = min(res, val);
}
return res;
}
Compilation message (stderr)
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |