제출 #127108

#제출 시각아이디문제언어결과실행 시간메모리
127108dragonslayerit도시들 (IOI15_towns)C++14
13 / 100
21 ms1016 KiB
#include "towns.h" #include <algorithm> int findfar(int N,int x){ int y=x; int dist=0; for(int i=0;i<N;i++){ if(i==x) continue; int tmp=getDistance(i,x); if(tmp>dist){ dist=tmp; y=i; } } return y; } int hubDistance(int N, int sub) { int x=findfar(N,0); int y=findfar(N,x); int dxy=getDistance(x,y); int R=dxy; for(int i=0;i<N;i++){ if(i==x||i==y) continue; int dxi=getDistance(x,i); int dyi=getDistance(y,i); R=std::min(R,std::max((dxi+dxy-dyi)/2,(dyi+dxy-dxi)/2)); } return R; }

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

towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:18: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...