# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1018703 | parsadox2 | Towns (IOI15_towns) | C++17 | 14 ms | 1028 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "towns.h"
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
const int N = 1e2 + 20;
int n , dis[N][N];
int hubDistance(int nn , int sub) {
n = nn;
pair <int , int> D = make_pair(0 , 1);
for(int i = 1 ; i < n ; i++)
{
dis[0][i] = dis[i][0] = getDistance(0 , i);
if(dis[0][i] > dis[D.F][D.S])
D = make_pair(0 , i);
}
for(int i = 0 ; i < n ; i++) if(i != D.S)
{
dis[i][D.S] = dis[D.S][i] = getDistance(i , D.S);
if(dis[i][D.S] > dis[D.F][D.S])
D = make_pair(i , D.S);
}
int ans = dis[D.F][D.S];
for(int x = 0 ; x < n ; x++)
{
dis[x][D.F] = dis[D.F][x] = getDistance(x , D.F);
int r = (dis[x][D.F] + dis[x][D.S] - dis[D.F][D.S]) / 2;
ans = min(ans , max(dis[x][D.F] , dis[x][D.S]) - r);
}
return ans;
}
Compilation message (stderr)
# | 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... |