이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "towns.h"
#include <bits/stdc++.h>
using namespace std;
int hubDistance(int N, int sub) {
pair<int, int > best = make_pair(-1,-1);
//first is dist, second is ind
for(int i = 1; i<N; i++){
pair<int, int> now = make_pair(getDistance(0,i),i);
best = max(best,now);
}
int first = best.second;
best = make_pair(-1,-1);
for(int i = 0; i<N; i++){
if(i==first){
continue;
}
pair<int, int> now = make_pair(getDistance(first,i),i);
best = max(best,now);
}
int second = best.second;
int diameter = getDistance(first,second);
int inf = 100000000;
int ans = inf;
for(int i = 0; i<N; i++){
if(i==first || i==second){
continue;
}
int A = getDistance(i,first);
int B = getDistance(i,second);
int x = (A+B-diameter)/2;
int a = A-x;
int b = B-x;
ans = min(ans,max(a,b));
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:4:28: warning: unused parameter 'sub' [-Wunused-parameter]
int hubDistance(int N, int sub) {
^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |