제출 #815386

#제출 시각아이디문제언어결과실행 시간메모리
815386kwongweng도시들 (IOI15_towns)C++17
25 / 100
13 ms1136 KiB
#include "towns.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef long double ld; typedef pair<ll, ll> pll; #define FOR(i, a, b) for(int i = a; i < b; i++) #define ROF(i, a, b) for(int i = a; i >= b; i--) #define ms memset #define pb push_back #define fi first #define se second #define dist(i,j) getDistance(i,j) int hubDistance(int N, int sub) { int d[N][N]; ms(d,0,sizeof(d)); int mx = 0, u=0; FOR(i,1,N){ d[0][i] = d[i][0] = dist(0,i); if (d[0][i] > mx){ mx=d[0][i]; u=i; } } mx=0; int v = 0; FOR(i,0,N){ if (i==u) continue; if (i>0) d[u][i]=d[i][u]=dist(i,u); if (d[u][i]>mx){ v=i; mx=d[u][i]; } } FOR(i,0,N){ if (i==u || i==v) continue; d[i][v]=d[v][i]=dist(i,v); } int R=2e9; FOR(i,0,N){ R=min(R,abs(d[u][i]-d[v][i])+d[u][v]); } R/=2; return R; }

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

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