Submission #400253

#TimeUsernameProblemLanguageResultExecution timeMemory
400253ly20Towns (IOI15_towns)C++17
Compilation error
0 ms0 KiB
//#include "towns.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 120; int dist[MAXN][MAXN]; int gd(int a, int b) { if(dist[a][b] == 0) { dist[a][b] = getDistance(a, b); dist[b][a] = dist[a][b]; } return dist[a][b]; } int hubDistance(int n, int sub) { //int resp = 0; int mx1 = 1, mx = 0; int a, b; for(int i = 2; i <= n; i++) { int d = gd(1, i); if(d > mx) { mx = d; mx1 = i; } } a = mx1; mx = 0; for(int i = 1; i <= n; i++) { if(i == a) continue; int d = gd(a, i); if(d > mx) { mx = d; mx1 = i; } } b = mx1; int dim = mx; //set <int> di; int resp = dim; for(int i = 1; i <= n; i++) { if(i == a || i == b) continue; int d = gd(a, i) - (gd(a, i) + gd(b, i) - dim) / 2; resp = min(resp, max(d, dim - d)); } return resp; }

Compilation message (stderr)

towns.cpp: In function 'int gd(int, int)':
towns.cpp:10:22: error: 'getDistance' was not declared in this scope
   10 |         dist[a][b] = getDistance(a, b);
      |                      ^~~~~~~~~~~
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:15:28: warning: unused parameter 'sub' [-Wunused-parameter]
   15 | int hubDistance(int n, int sub) {
      |                        ~~~~^~~