# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
127108 | dragonslayerit | Towns (IOI15_towns) | C++14 | 21 ms | 1016 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 <algorithm>
int findfar(int N,int x){
int y=x;
int dist=0;
for(int i=0;i<N;i++){
if(i==x) continue;
int tmp=getDistance(i,x);
if(tmp>dist){
dist=tmp;
y=i;
}
}
return y;
}
int hubDistance(int N, int sub) {
int x=findfar(N,0);
int y=findfar(N,x);
int dxy=getDistance(x,y);
int R=dxy;
for(int i=0;i<N;i++){
if(i==x||i==y) continue;
int dxi=getDistance(x,i);
int dyi=getDistance(y,i);
R=std::min(R,std::max((dxi+dxy-dyi)/2,(dyi+dxy-dxi)/2));
}
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... |