# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
420566 | LouayFarah | Towns (IOI15_towns) | C++14 | 2 ms | 464 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 "bits/stdc++.h"
#include "towns.h"
using namespace std;
vector<vector<int>> dist;
vector<int> em;
int getDistance(int i, int j);
int hubDistance(int n, int sub)
{
em.assign(0, n);
dist.assign(n, em);
for(int i = 0; i<n; i++)
{
for(int j = i+1; j<n; j++)
{
int d = getDistance(i, j);
dist[i][j] = d;
dist[j][i] = d;
}
}
int R = 1e9;
for(int i = 0; i<n; i++)
{
for(int j = i+1; j<n; j++)
{
int node = -1;
int maxi = -1;
for(int k = 0; k<n; k++)
{
if(k==i||k==j)
continue;
if(dist[i][k]+dist[j][k]>maxi)
{
maxi = dist[i][k] + dist[j][k];
node = k;
}
}
int temp = (dist[i][node] + dist[j][node] - dist[i][j])/2;
R = min(R, temp);
}
}
return R;
}
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... |