# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
71624 | mr_banana | Towns (IOI15_towns) | C++17 | 28 ms | 928 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 <iostream>
#include "towns.h"
using namespace std;
const int MN=200,inf=1e9;
int dist[MN][MN];
bool mark[MN][MN];
int n;
int getdists(int x){
int mi=0;
for(int i=0;i<n;i++){
if(!mark[x][i]){
dist[x][i]=dist[i][x]=getDistance(x,i);
mark[x][i]=mark[i][x]=1;
}
if(dist[x][i]>dist[x][mi]){
mi=i;
}
}
return mi;
}
int hubDistance(int N, int sub) {
n=N;
int u=getdists(0);
int v=getdists(u);
int ans=inf;
for(int i=0;i<n;i++){
int d=(dist[i][v]+dist[i][u]-dist[u][v])/2;
ans=min(ans,max(dist[i][v],dist[i][u])-d);
}
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... |