# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
233267 | mieszko11b | Towns (IOI15_towns) | C++14 | 27 ms | 1152 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 v = 0, s, t;
int distv[120], dists[120];
int hubDistance(int N, int sub) {
int maxv = 0;
for(int i = 0 ; i < N ; i++) {
distv[i] = getDistance(v, i);
maxv = max(maxv, distv[i]);
}
for(int i = 0 ; i < N ; i++)
if(distv[i] == maxv)
s = i;
int dsv = maxv;
maxv = 0;
for(int i = 0 ; i < N ; i++) {
dists[i] = getDistance(s, i);
maxv = max(maxv, dists[i]);
}
int d = maxv;
for(int i = 0 ; i < N ; i++)
if(dists[i] == maxv)
t = i;
int res = 1e9;
for(int i = 0 ; i < N ; i++) {
int a = (dists[i] + dsv - distv[i]) / 2;
int b = dsv - a;
res = min(res, max({a, b, d - a}));
//~ cout << i << " " << res << endl;
}
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... |