Submission #422773

#TimeUsernameProblemLanguageResultExecution timeMemory
422773vanicTowns (IOI15_towns)C++14
0 / 100
20 ms396 KiB
#include "towns.h" #include <algorithm> #include <iostream> using namespace std; const int maxn=120; int dist[maxn][maxn]; int hubDistance(int n, int sub) { int ind=0; int maksi=0; for(int i=1; i<n; i++){ dist[0][i]=dist[i][0]=getDistance(0, i); if(maksi<dist[0][i]){ maksi=dist[0][i]; ind=i; } } int ind1=0; maksi=0; for(int i=0; i<n; i++){ if(ind==i){ continue; } if(!dist[i][ind]){ dist[i][ind]=dist[ind][i]=getDistance(ind, i); } if(dist[i][ind]>maksi){ maksi=dist[i][ind]; ind1=i; } } swap(ind, ind1); for(int i=0; i<n; i++){ if(ind==i){ continue; } if(!dist[i][ind]){ dist[i][ind]=dist[ind][i]=getDistance(ind, i); } } // cout << ind << ' ' << ind1 << endl; // cout << maksi << endl; int mini=1e9; int br; for(int i=0; i<n; i++){ if(i==ind || i==ind1){ continue; } // cout << i << ' ' << dist[i][ind] << ' ' << dist[i][ind1] << endl; br=(dist[i][ind]+dist[i][ind1]-maksi)/2; br=max(dist[i][ind], dist[i][ind1])-br; // cout << br << endl; mini=min(mini, br); } return mini; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:13:28: warning: unused parameter 'sub' [-Wunused-parameter]
   13 | 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...