# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
781685 | vjudge1 | Towns (IOI15_towns) | C++17 | 28 ms | 872 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;
#define sp " "
#define endl "\n"
#define pii pair<int, int>
#define ft first
#define nd second
#define pb push_back
const int INF = 1e9 + 7;
int hubDistance(int N, int sub) {
int dist[N][N];
for (int i = 0; i < N; i++){
dist[i][i] = 0;
for (int j = i + 1; j < N; j++){
dist[i][j] = dist[j][i] = getDistance(i, j);
}
}
int ans = INF;
for (int i = 0; i < N; i++){
for (int j = i + 1; j < N; j++){
int d1 = (dist[1][i] - dist[1][j] + dist[i][j]) / 2;
int d2 = dist[i][j] - d1;
int curr = max(d1, d2);
for (int k = 0; k < N; k++){
int x1 = dist[k][i] - d1, x2 = dist[k][j] - d2;
curr = max(curr, max(x1, x2));
}
//cout<<i<<sp<<j<<sp<<curr<<endl;
ans = min(ans, curr);
}
}
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... |