# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
590891 | FatihSolak | Towns (IOI15_towns) | C++17 | 13 ms | 1108 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>
#define N 200
using namespace std;
int dist[N][N];
int get(int i,int j){
if(i > j)swap(i,j);
if(i == j)return 0;
if(dist[i][j])return dist[i][j];
return dist[i][j] = getDistance(i,j);
}
int hubDistance(int n, int sub) {
int R = getDistance(0,1);
int root = 0;
for(int i = 1;i<n;i++){
if(get(0,i) > get(0,root))
root = i;
}
int deepest = 0;
for(int i = 1;i<n;i++){
if(get(root,i) > get(root,deepest))
deepest = i;
}
set<int> depths;
for(int i = 0;i<n;i++){
depths.insert( (get(root,deepest) + get(root,i) -get(deepest,i) )/2);
}
int mini = 1e9;
for(auto u:depths){
mini = min(mini,max(u,get(root,deepest)-u));
}
return mini;
}
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... |