Submission #420582

#TimeUsernameProblemLanguageResultExecution timeMemory
420582LouayFarahTowns (IOI15_towns)C++14
0 / 100
43 ms844 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(n, 0); 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); } } if(sub==2) return R; return R; }
#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...