제출 #400257

#제출 시각아이디문제언어결과실행 시간메모리
400257ly20도시들 (IOI15_towns)C++17
0 / 100
25 ms400 KiB
#include "towns.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 120; /* int ds[MAXN][MAXN]; int getDistance(int a, int b) { return ds[a][b]; }*/ int dist[MAXN][MAXN]; int gd(int a, int b) { if(dist[a][b] == 0) { dist[a][b] = getDistance(a, b); dist[b][a] = dist[a][b]; } return dist[a][b]; } int hubDistance(int n, int sub) { //int resp = 0; int mx1 = 1, mx = 0; int a, b; for(int i = 1; i < n; i++) { int d = gd(1, i); if(d > mx) { mx = d; mx1 = i; } } a = mx1; mx = 0; for(int i = 0; i < n; i++) { if(i == a) continue; int d = gd(a, i); if(d > mx) { mx = d; mx1 = i; } } b = mx1; int dim = mx; //set <int> di; int resp = dim; for(int i = 0; i < n; i++) { if(i == a || i == b) continue; int d = gd(a, i) - (gd(a, i) + gd(b, i) - dim) / 2; resp = min(resp, max(d, dim - d)); } return resp; } /* int main() { int n; scanf("%d", &n); for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { scanf("%d", &ds[i][j]); } } printf("%d\n", hubDistance(n, 0)); return 0; }*/

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

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