제출 #422748

#제출 시각아이디문제언어결과실행 시간메모리
422748vanic도시들 (IOI15_towns)C++14
0 / 100
21 ms1120 KiB
#include "towns.h" #include <algorithm> #include <iostream> using namespace std; const int maxn=120; int dist[maxn][maxn]; int hubDistance(int n, int sub) { int ind=0; int maksi=0; for(int i=1; i<n; i++){ dist[0][i]=dist[i][0]=getDistance(0, i); if(maksi<dist[0][i]){ maksi=dist[0][i]; ind=i; } } int ind1=0; maksi=0; for(int i=0; i<n; i++){ if(ind==i){ continue; } if(!dist[i][ind]){ dist[i][ind]=dist[ind][i]=getDistance(ind, i); } if(dist[i][ind]>maksi){ maksi=dist[i][ind]; ind1=i; } } swap(ind, ind1); for(int i=0; i<n; i++){ if(ind==i){ continue; } if(!dist[i][ind]){ dist[i][ind]=dist[ind][i]=getDistance(ind, i); } } // cout << ind << ' ' << ind1 << endl; // cout << maksi << endl; int mini=1e9; int br; for(int i=0; i<n; i++){ // cout << i << ' ' << dist[i][ind] << ' ' << dist[i][ind1] << endl; br=(dist[i][ind]+dist[i][ind1]-maksi)/2; br=max(dist[i][ind]-br, dist[i][ind1]-br); // cout << br << endl; mini=min(mini, br); } return mini; }

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

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