Submission #16527

#TimeUsernameProblemLanguageResultExecution timeMemory
16527gs13068Towns (IOI15_towns)C++98
0 / 100
21 ms1180 KiB
#include "towns.h" #include <algorithm> int d[111][111]; int getDist(int i,int j) { if(i==j)return 0; if(i>j)std::swap(i,j); if(!d[i][j])d[i][j]=getDistance(i,j); return d[i][j]; } int hubDistance(int n, int s) { int m1,m2; int i; for(i=m1=0;i<n;i++)if(getDist(0,i)>getDist(0,m1))m1=i; for(i=m2=0;i<n;i++)if(getDist(m1,i)>getDist(m1,m2))m2=i; return(getDist(0,m1)+getDist(m1,m2)-getDist(0,m2))/2; }
#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...