이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "towns.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
int hubDistance(int n, int sub) {
vector<int>A(n), B(n), C(n);
pair<int,int>ma={0, 0};
for(int i=1; i<n; ++i) {
A[i]=getDistance(0, i);
ma=max(ma, {A[i], i});
}
int x=ma.nd;
B[0]=ma.st;
for(int i=1; i<n; ++i) if(i!=x) B[i]=getDistance(x, i);
rep(i, n) C[i]=B[i]-(A[i]+B[i]-B[0])/2;
ma={0, 0};
rep(i, n) ma=max(ma, {B[i], i});
int y=ma.nd;
int ans=max(C[y], B[y]-C[y]);
rep(i, n) if(C[i]<=C[y]) ans=min(ans, max(C[i], C[y]-C[i]+B[y]-C[y]));
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:9:28: warning: unused parameter 'sub' [-Wunused-parameter]
9 | 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... |