Submission #207272

# Submission time Handle Problem Language Result Execution time Memory
207272 2020-03-07T00:03:26 Z AQT Towns (IOI15_towns) C++14
Compilation error
0 ms 0 KB
//#include <towns.h>
#include <bits/stdc++.h>

using namespace std;

int dist[200][200];

int centDistance(int i, int j, int k){
    return (dist[i][j] + dist[i][k] - dist[j][k])/2;
}

int hubDistance(int N, int sub){
    int d1 = 0, d2 = 0;
    for(int i = 1; i<N; i++){
        dist[0][i] = getDistance(0, i);
        if(dist[0][i] > dist[0][d1]){
            d1 = i;
        }
    }
    for(int i = 0; i<N; i++){
        dist[d1][i] = getDistance(d1, i);
        if(dist[d1][i] > dist[d1][d2]){
            d2 = i;
        }
    }
    int dia = dist[d1][d2];
    int ans = 0;
    for(int i = 0; i<N; i++){
        int k = centDistance(i, 0, d1);
        if(abs(ans-dia/2) > abs(k-dia/2)){
            ans = k;
        }
    }
    return ret;
}

Compilation message

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:15:22: error: 'getDistance' was not declared in this scope
         dist[0][i] = getDistance(0, i);
                      ^~~~~~~~~~~
towns.cpp:15:22: note: suggested alternative: 'centDistance'
         dist[0][i] = getDistance(0, i);
                      ^~~~~~~~~~~
                      centDistance
towns.cpp:21:23: error: 'getDistance' was not declared in this scope
         dist[d1][i] = getDistance(d1, i);
                       ^~~~~~~~~~~
towns.cpp:21:23: note: suggested alternative: 'centDistance'
         dist[d1][i] = getDistance(d1, i);
                       ^~~~~~~~~~~
                       centDistance
towns.cpp:34:12: error: 'ret' was not declared in this scope
     return ret;
            ^~~
towns.cpp:34:12: note: suggested alternative: 'getw'
     return ret;
            ^~~
            getw
towns.cpp:12:28: warning: unused parameter 'sub' [-Wunused-parameter]
 int hubDistance(int N, int sub){
                            ^~~