제출 #420561

#제출 시각아이디문제언어결과실행 시간메모리
420561LouayFarah도시들 (IOI15_towns)C++14
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" #include "towns.h" using namespace std; vector<vector<int>> dist; vector<int> em; int getDistance(int i, int j); long long min(long long a, long long b) { if(a<=b) return a; return b; } long long 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; } } long long R = 1e18; for(int i = 0; i<n; i++) { for(int j = i+1; j<n; j++) { int node = -1; long long 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; } } long long temp = (dist[i][node] + dist[j][node] - dist[i][j])/2; R = min(R, temp); } } return R; }

컴파일 시 표준 에러 (stderr) 메시지

towns.cpp:17:11: error: ambiguating new declaration of 'long long int hubDistance(int, int)'
   17 | long long hubDistance(int n, int sub)
      |           ^~~~~~~~~~~
In file included from towns.cpp:2:
towns.h:5:5: note: old declaration 'int hubDistance(int, int)'
    5 | int hubDistance(int N, int sub);
      |     ^~~~~~~~~~~
towns.cpp: In function 'long long int hubDistance(int, int)':
towns.cpp:17:34: warning: unused parameter 'sub' [-Wunused-parameter]
   17 | long long hubDistance(int n, int sub)
      |                              ~~~~^~~