Submission #127108

#TimeUsernameProblemLanguageResultExecution timeMemory
127108dragonslayeritTowns (IOI15_towns)C++14
13 / 100
21 ms1016 KiB
#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)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:18:28: warning: unused parameter 'sub' [-Wunused-parameter]
 int hubDistance(int N, int sub) {
                            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...