Submission #420566

#TimeUsernameProblemLanguageResultExecution timeMemory
420566LouayFarahTowns (IOI15_towns)C++14
0 / 100
2 ms464 KiB
#include "bits/stdc++.h" #include "towns.h" using namespace std; vector<vector<int>> dist; vector<int> em; int getDistance(int i, int j); int hubDistance(int n, int sub) { em.assign(0, n); dist.assign(n, em); for(int i = 0; i<n; i++) { for(int j = i+1; j<n; j++) { int d = getDistance(i, j); dist[i][j] = d; dist[j][i] = d; } } int R = 1e9; for(int i = 0; i<n; i++) { for(int j = i+1; j<n; j++) { int node = -1; int maxi = -1; for(int k = 0; k<n; k++) { if(k==i||k==j) continue; if(dist[i][k]+dist[j][k]>maxi) { maxi = dist[i][k] + dist[j][k]; node = k; } } int temp = (dist[i][node] + dist[j][node] - dist[i][j])/2; R = min(R, temp); } } return R; }

Compilation message (stderr)

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