제출 #556778

#제출 시각아이디문제언어결과실행 시간메모리
556778blue도시들 (IOI15_towns)C++17
컴파일 에러
0 ms0 KiB
#include "towns.h" #include <vector> #include <cmath> #include <set> #include <iostream> using namespace std; namespace { using vi = vector<int>; } int hubDistance(int N, int sub) { vi dist0(N); dist0[0] = 0; for(int i = 1; i < N; i++) dist0[i] = getDistance(0, i); int S = 0; for(int i = 1; i < N; i++) if(dist0[i] > dist0[S]) S = i; int ST = 0; //diameter // cerr << "done\n"; vi distS(N); distS[S] = 0; distS[0] = dist0[S]; int T = 0; ST = distS[0]; for(int i = 1; i < N; i++) { if(i != S) { distS[i] = getDistance(S, i); if(distS[i] > ST) { ST = distS[i]; T = i; } } } // cerr << "S = " << S << "\n"; vi S0_dist(N); for(int i = 0; i < N; i++) S0_dist[i] = (distS[i] + dist0[i] - distS[0])/2; vi xcoord(N); for(int i = 0; i < N; i++) xcoord[i] = distS[i] - S0_dist[i]; int res = 5'000'000; int best_coord = 0; for(int i = 0; i < N; i++) { if(2 * xcoord[i] > ST) continue; if(ST - x_coord > ST - best_coord) best_coord = x_coord; } return ST - best_coord; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:69:11: error: 'x_coord' was not declared in this scope; did you mean 'xcoord'?
   69 |   if(ST - x_coord > ST - best_coord)
      |           ^~~~~~~
      |           xcoord
towns.cpp:62:6: warning: unused variable 'res' [-Wunused-variable]
   62 |  int res = 5'000'000;
      |      ^~~
towns.cpp:14:28: warning: unused parameter 'sub' [-Wunused-parameter]
   14 | int hubDistance(int N, int sub)
      |                        ~~~~^~~