제출 #1036593

#제출 시각아이디문제언어결과실행 시간메모리
1036593vjudge1도시들 (IOI15_towns)C++17
25 / 100
10 ms1228 KiB
#include "towns.h" #include<bits/stdc++.h> using namespace std; int n; int dist[200][200]; int query(int i,int j){ if(j<i)swap(i,j); if(!dist[i][j])dist[i][j]=getDistance(i,j); return dist[i][j]; } int hubDistance(int N, int sub) { memset(dist,0,sizeof(dist)); n=N; int past=-1,point1=-1; for(int i=1;i<n;i++){ if(past<query(0,i)){ point1=i; past=query(0,i); } } past=-1; int point2=-1; for(int i=0;i<n;i++){ if(i==point1)continue; if(past<query(point1,i)){ point2=i; past=query(point1,i); } } int ds=query(point1,point2); int ans=1e9; for(int i=0;i<n;i++){ if(i==point1||i==point2)continue; int tem=(query(point1,i)+query(point2,i)-ds)/2; int val1=query(point1,i)-tem; int val2=query(point2,i)-tem; ans=min(ans,max({tem,val1,val2})); } return ans; }

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

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