제출 #990286

#제출 시각아이디문제언어결과실행 시간메모리
990286starchan도시들 (IOI15_towns)C++17
25 / 100
12 ms1116 KiB
#include<bits/stdc++.h> #include "towns.h" using namespace std; #define in array<int, 2> #define pb push_back #define pob pop_back int hubDistance(int n, int sub) { in opt = {0, 0}; for(int i = 1; i < n; i++) opt = max(opt, {getDistance(i, 0), i}); int a = opt[1]; opt = {0, a}; vector<int> d1(n), d2(n); d1[a] = 0; for(int i = 0; i < n; i++) { if(i == a) continue; opt = max(opt, {d1[i] = getDistance(i, a), i}); } auto [D, b] = opt; d2[b] = 0; map<int, vector<int>> diam; diam[0].pb(a); diam[D].pb(b); for(int i = 0; i < n; i++) { if(i == a || i == b) continue; d2[i] = getDistance(i, b); diam[(d1[i]-d2[i]+D)/2].pb(i); } int R = 1e9+1; for(auto [X, v]: diam) R = min(R, max(X, D-X)); vector<vector<int>> gd; for(auto [X, v]: diam) { if(max(X, D-X) == R) gd.pb(v); } return R; }

컴파일 시 표준 에러 (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...