# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1082738 | vjudge1 | Towns (IOI15_towns) | C++17 | 11 ms | 1372 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 = 500;
int memo[N][N];
int dist(int u,int v){
if(u == v)return 0;
if(u > v)swap(u, v);
if(memo[u][v] != -1)return memo[u][v];
return memo[u][v] = getDistance(u, v);
}
int hubDistance(int n, int sub) {
memset(memo, -1, sizeof memo);
int u = 0;
for(int i = 1;i < n;i++){
if(dist(i, 0) > dist(u, 0))u = i;
}
int v = 0;
for(int i = 1;i < n;i++){
if(dist(i, u) > dist(v, u))v = i;
}
return dist(u, v);
}
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... |