제출 #1122157

#제출 시각아이디문제언어결과실행 시간메모리
1122157SalihSahin도시들 (IOI15_towns)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back using namespace std; #include "towns.h" int hubDistance(int N, int sub) { int d1 = 0, dis = 0; for(int i = 1; i < N; i++){ int x = getDistance(0, i); if(x > dis){ d1 = i; ds = x; } } int d2 = 0; dis = 0; for(int i = 0; i < N; i++){ int x = getDistance(d1, i); if(x > dis){ d2 = i; dis = x; } } int diameter = dis; int other = 0; while(other == d1 || other == d2) other++; int c1 = getDistance(d1, other), c2 = getDistance(d2, other); int othertoroot = ((c1 + c2) - diameter)/2; int R = max(c1 - othertoroot, c2 - othertoroot); return R; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:12:13: error: 'ds' was not declared in this scope; did you mean 'dis'?
   12 |             ds = x;
      |             ^~
      |             dis
towns.cpp:6:28: warning: unused parameter 'sub' [-Wunused-parameter]
    6 | int hubDistance(int N, int sub) {
      |                        ~~~~^~~