제출 #427142

#제출 시각아이디문제언어결과실행 시간메모리
427142ollel도시들 (IOI15_towns)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <iostream> // #include "towns.h" using namespace std; #define rep(i,a,b) for(int i = a; i < b; i++) #define pb push_back #define lso(x) x&(-x) typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; int n, s; // // int getDistance(int i, int j) { // cout << i << " " << j << endl; // int ans; // cin >> ans; // return ans; // } int hubDistance(int N, int S) { n = N; s = S; vvi d(n, vi(n)); rep(i,0,n) d[i][i] = 0; rep(i, 0, n) rep(j, i + 1, n) { d[i][j] = d[j][i] = getDistance(i, j); } int a, b, m = 0; rep(i,0,n) rep(j,i+1,n) { if (d[i][j] > m) {a = i; b = j; m = d[i][j];} } int ab = d[a][b]; rep(k, 1, ab) { int s = ab - k; rep(c,0,n) { if ((c == a) || (c == b)) continue; if (d[a][c] - k == d[b][c] - s) return max(s, k); } } } // // int main() { // int n; cin >> n; // cout << hubDistance(n, 0); // }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:29:25: error: 'getDistance' was not declared in this scope; did you mean 'hubDistance'?
   29 |     d[i][j] = d[j][i] = getDistance(i, j);
      |                         ^~~~~~~~~~~
      |                         hubDistance
towns.cpp:40:9: warning: declaration of 's' shadows a global declaration [-Wshadow]
   40 |     int s = ab - k;
      |         ^
towns.cpp:14:8: note: shadowed declaration is here
   14 | int n, s;
      |        ^
towns.cpp:26:17: warning: control reaches end of non-void function [-Wreturn-type]
   26 |   vvi d(n, vi(n));
      |                 ^