제출 #167465

#제출 시각아이디문제언어결과실행 시간메모리
167465faremy도시들 (IOI15_towns)C++14
25 / 100
27 ms1172 KiB
#include "towns.h" #include <algorithm> #include <iostream> const int MAXN = 110; int distToEnd[MAXN]; int hubDistance(int N, int sub) { int farthest = 0, end = 0; for (int iNode = 0; iNode < N; iNode++) { int dist = getDistance(0, iNode); if (dist > farthest) { farthest = dist; end = iNode; } } int diameter = 0, otherEnd = end; for (int iNode = 0; iNode < N; iNode++) { distToEnd[iNode] = getDistance(end, iNode); if (distToEnd[iNode] > diameter) { diameter = distToEnd[iNode]; otherEnd = iNode; } } int minMaxDist = diameter; for (int iNode = 0; iNode < N; iNode++) { int distToOth = getDistance(iNode, otherEnd); int half = (diameter + distToEnd[iNode] - distToOth) / 2; minMaxDist = std::min(minMaxDist, std::max(half, diameter - half)); } return minMaxDist; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:12:28: warning: unused parameter 'sub' [-Wunused-parameter]
 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...