이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "towns.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i =a; i<int(b); i++)
int hubDistance(int N, int sub) {
int high=-1;
int highind=-1;
rep(i,1,N) {
int dist=getDistance(0,i);
if (dist>high) {high=dist; highind=i;}
}
int A=highind;
int Adists[N];
high=-1;
highind=-1;
rep (i,0,N) {
Adists[i]=getDistance(A,i);
if (Adists[i]>high) {high=Adists[i]; highind=i;}
}
int B=highind;
int diameter=high;
int Bdists[N];
rep (i,0,N) {
Bdists[i]=getDistance(B,i);
}
int pos[N];
rep (i,0,N) {
int extra=(Adists[i]+Bdists[i]-diameter)/2;
pos[i]=Adists[i]-extra;
}
int R=diameter;
rep (i,0,N) {
int newr;
newr=max(pos[i],diameter-pos[i]);
R=min(R,newr);
}
return R;
}
컴파일 시 표준 에러 (stderr) 메시지
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:5: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... |