Submission #210955

#TimeUsernameProblemLanguageResultExecution timeMemory
210955autumn_eelTowns (IOI15_towns)C++14
25 / 100
29 ms1280 KiB
#include "towns.h" #include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; int d[150][150]; int dist(int i,int j){ if(i==j)return 0; if(i>j)swap(i,j); if(d[i][j]!=-1)return d[i][j]; int x=getDistance(i,j); return d[i][j]=x; } int hubDistance(int N, int sub) { memset(d,-1,sizeof(d)); int Max=0,s=-1; rep(i,N){ if(Max<dist(0,i)){ Max=dist(0,i); s=i; } } Max=0;int t=-1; rep(i,N){ if(Max<dist(s,i)){ Max=dist(s,i); t=i; } } int Min=INT_MAX; rep(i,N){ int x=dist(s,i),y=dist(t,i); int z=(x+y-Max)/2; int a=x-z,b=y-z; Min=min(Min,max(a,b)); } return Min; }

Compilation message (stderr)

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