이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "towns.h"
#include <bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;
#define X first
#define Y second
#define pb push_back
typedef pair<int, int> ii;
typedef long long ll;
const int maxn = 120;
int m, n;
int dist[maxn];
map<int, int> faker;
int hubDistance(int N, int sub)
{
if(sub > 1) return 0;
n = N;
int best = 0, dat = -1;
for(int i = 1; i< N; i++)
{
int here = getDistance(0, i);
if(here> best)
{
best = here;
dat = i;
}
}
int U = dat;
best = 0; dat = -1;
for(int i = 0; i< N; i++)
{
if(i == U) continue;
dist[i] = getDistance(U, i);
if(dist[i]> best)
{
best = dist[i];
dat = i;
}
}
int V = dat;
printf("(%d->%d) %d\n", U, V, dist[V]);
for(int i = 0; i< N; i++)
{
if(i == U || i == V) continue;
int br = dist[i]+getDistance(V, i)-dist[V];
br /= 2;
int run = dist[i]-br;
faker[run] = max(faker[run], br);
}
int rad = 1e9;
for(auto kk : faker)
{
int x = kk.X, y = kk.Y;
// printf("%d\n", max(y, max(x, dist[V]-x)));
rad = min(rad, max(y, max(x, dist[V]-x)));
}
return rad;
}
# | 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... |