# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1122161 | SalihSahin | Towns (IOI15_towns) | C++14 | 15 ms | 592 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>
#define pb push_back
using namespace std;
#include "towns.h"
int hubDistance(int N, int sub) {
int d1 = 0, dis = 0;
for(int i = 1; i < N; i++){
int x = getDistance(0, i);
if(x > dis){
d1 = i;
dis = x;
}
}
vector<int> distod1(N);
int d2 = 0;
dis = 0;
for(int i = 0; i < N; i++){
int x = getDistance(d1, i);
distod1[i] = x;
if(x > dis){
d2 = i;
dis = x;
}
}
int diameter = dis;
int R = 1e9;
for(int i = 0; i < N; i++){
if(i == d1 || i == d2) continue;
int other = i;
int c1 = distod1[other], c2 = getDistance(d2, other);
int othertoroot = ((c1 + c2) - diameter)/2;
int Rcan = max(c1 - othertoroot, c2 - othertoroot);
R = min(R, Rcan);
}
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... |