Submission #151460

#TimeUsernameProblemLanguageResultExecution timeMemory
151460Bodo171Towns (IOI15_towns)C++14
25 / 100
21 ms404 KiB
#include "towns.h" #include <iostream> #include <algorithm> #include <vector> using namespace std; const int nmax=205; int n; int d[2][nmax]; int to[nmax],wh[nmax],sz[nmax]; int hubDistance(int N, int sub) { int d1=0,R=0,mx=0,d2=0; n=N; for(int i=0;i<2;i++) for(int j=0;j<n;j++) d[i][j]=0; for(int i=1; i<n; i++) { d[0][i]=getDistance(0,i); if(d[0][i]>d[0][d1]) d1=i; } for(int i=0; i<n; i++) if(i!=d1) { d[1][i]=getDistance(d1,i); if(d[1][i]>mx) mx=d[1][i],d2=i; } int minDist=(1<<30); int lim=d[1][d2]-(d[0][d2]+d[1][d2]-d[0][d1])/2; for(int i=0; i<n; i++) { to[i]=(d[0][i]+d[1][i]-d[0][d1])/2; wh[i]=(d[1][i]-to[i]); if(max(wh[i],mx-wh[i])<minDist&&wh[i]<=lim) minDist=max(wh[i],mx-wh[i]); } R=minDist; return R; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:13: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...