# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
410977 | ja_kingy | Towns (IOI15_towns) | C++14 | 19 ms | 964 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 "towns.h"
#include <bits/stdc++.h>
using namespace std;
int hubDistance(int n, int sub) {
vector<int> d0(n), d1(n);
int mx = 0, R = 1e9;
for (int i = 1; i < n; ++i) {
d0[i] = getDistance(0, i);
if (d0[i] > d0[mx]) mx = i;
}
d1[0] = d0[mx];
int d = d0[mx];
map<int, vector<int>> groups;
for (int i = 1; i < n; ++i) if (i != mx) {
d1[i] = getDistance(mx, i);
groups[(d1[i] - d0[i] + d0[mx]) / 2].push_back(i);
d = max(d, d1[i]);
}
//cerr << mx << ' ' << d << ' ' << endl;
int hub = 0;
for (auto g: groups) {
R = min(R, max(g.first, d-g.first));
//cerr << g.first << ' ' << g.second.size() << endl;
}
//cerr << R << endl;
return R;
}
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... |