제출 #617679

#제출 시각아이디문제언어결과실행 시간메모리
617679chirathnirodha도시들 (IOI15_towns)C++17
25 / 100
14 ms836 KiB
#include "towns.h" #include<bits/stdc++.h> using namespace std; #define PB push_back #define F first #define S second int hubDistance(int N, int sub) { int n=N; pair<int,int> maxdis={-1,-1}; for(int i=0;i<n;i++){ int x=getDistance(0,i); if(x>maxdis.F)maxdis={x,i}; } int a=maxdis.S; maxdis={-1,-1}; int dista[n],distb[n]; for(int i=0;i<n;i++){ int x=getDistance(a,i);dista[i]=x; if(x>maxdis.F)maxdis={x,i}; } int b=maxdis.S; int dia=maxdis.F; int ans=dia; for(int i=0;i<n;i++)distb[i]=getDistance(i,b); for(int i=0;i<n;i++){ int itodia=(dista[i]+distb[i]-dia)/2; ans=min(ans,max(dista[i]-itodia,distb[i]-itodia)); } return ans; }

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

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