제출 #1168755

#제출 시각아이디문제언어결과실행 시간메모리
1168755anmattroi도시들 (IOI15_towns)C++17
25 / 100
19 ms328 KiB
#include "towns.h" #include <bits/stdc++.h> #define maxn 115 using namespace std; int hubDistance(int N, int sub) { int *cached = new int[N]; int mx = -1, nodeA = -1, nodeB = -1; for (int i = 1; i < N; i++) { int t = getDistance(0, i); if (mx < t) { mx = t; nodeA = i; } } mx = -1; for (int i = 0; i < N; i++) if (i != nodeA) { int t = getDistance(nodeA, i); cached[i] = t; if (mx < t) { mx = t; nodeB = i; } } int tong = mx; int ans = INT_MAX; for (int i = 0; i < N; i++) if (i != nodeA and i != nodeB) { int hieu = cached[i] - getDistance(i, nodeB); if (hieu < 0) hieu = -hieu; ans = min(ans, (hieu+tong)/2); } return ans; }
#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...