# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
431959 | arayi | Towns (IOI15_towns) | C++17 | 27 ms | 460 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>
using namespace std;
const int N = 150;
int n;
int d[N][N];
int hubDistance(int N, int sub)
{
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++) d[i][j] = 0;
n = N;
int a = 0;
for (int i = 1; i < n; i++)
{
d[0][i] = d[i][0] = getDistance(0, i);
if(d[0][i] > d[0][a]) a = i;
}
int b = 0;
for (int i = 1; i < n; i++)
{
if(a == i) continue;
d[a][i] = d[i][a] = getDistance(a, i);
if(d[a][i] > d[a][b]) b = i;
}
int pat = d[a][b];
for (int i = 0; i < n; i++)
{
if(i == a || i == b) continue;
int c = (d[a][i]+d[i][b] - d[a][b])/2;
pat = min(pat, max(d[a][i], d[i][b]) - c);
}
return pat;
}
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... |