Submission #590891

#TimeUsernameProblemLanguageResultExecution timeMemory
590891FatihSolakTowns (IOI15_towns)C++17
0 / 100
13 ms1108 KiB
#include "towns.h" #include <bits/stdc++.h> #define N 200 using namespace std; int dist[N][N]; int get(int i,int j){ if(i > j)swap(i,j); if(i == j)return 0; if(dist[i][j])return dist[i][j]; return dist[i][j] = getDistance(i,j); } int hubDistance(int n, int sub) { int R = getDistance(0,1); int root = 0; for(int i = 1;i<n;i++){ if(get(0,i) > get(0,root)) root = i; } int deepest = 0; for(int i = 1;i<n;i++){ if(get(root,i) > get(root,deepest)) deepest = i; } set<int> depths; for(int i = 0;i<n;i++){ depths.insert( (get(root,deepest) + get(root,i) -get(deepest,i) )/2); } int mini = 1e9; for(auto u:depths){ mini = min(mini,max(u,get(root,deepest)-u)); } return mini; }

Compilation message (stderr)

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:13:6: warning: unused variable 'R' [-Wunused-variable]
   13 |  int R = getDistance(0,1);
      |      ^
towns.cpp:12:28: warning: unused parameter 'sub' [-Wunused-parameter]
   12 | 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...