# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1018701 | parsadox2 | Towns (IOI15_towns) | C++17 | 22 ms | 1112 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;
for(int i = 0 ; i < n ; i++) for(int j = i + 1 ; j < n ; j++)
dis[i][j] = dis[j][i] = getDistance(i , j);
pair <int , int> D = make_pair(0 , 1);
for(int i = 0 ; i < n ; i++) for(int j = i + 1 ; j < n ; j++) if(dis[i][j] > dis[D.F][D.S])
D = make_pair(i , j);
int ans = dis[D.F][D.S];
//cout << D.F << " " << D.S << " " << dis[D.F][D.S] << endl;
for(int x = 0 ; x < n ; x++)
{
int r = (dis[x][D.F] + dis[x][D.S] - dis[D.F][D.S]) / 2;
//cout << x << " " << r << " " << dis[x][D.F] << " " << dis[x][D.S] << endl;
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... |