제출 #494640

#제출 시각아이디문제언어결과실행 시간메모리
494640thecodingwizard도시들 (IOI15_towns)C++11
13 / 100
13 ms844 KiB
#include <bits/stdc++.h> #include "towns.h" using namespace std; int hubDistance(int N, int sub) { int maxDist = -1, maxDistNode = -1; for (int i = 1; i < N; i++) { int d = getDistance(0, i); if (d > maxDist) { maxDist = d; maxDistNode = i; } } maxDist = -1; int maxDistNode2 = -1; for (int i = 0; i < N; i++) { int d = getDistance(maxDistNode, i); if (d > maxDist) { maxDist = d; maxDistNode2 = i; } } int opt = 1e9; for (int i = 0; i < N; i++) { int distTo0 = getDistance(maxDistNode2, i); int distTo1 = getDistance(maxDistNode, i); int dist0 = (maxDist + distTo0 - distTo1)/2; int dist1 = (maxDist + distTo1 - distTo0)/2; opt = min(opt, max(dist0, dist1)); } return opt; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:6:28: warning: unused parameter 'sub' [-Wunused-parameter]
    6 | int hubDistance(int N, int sub) {
      |                        ~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...