# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1122687 | gustavo_d | 도시들 (IOI15_towns) | C++17 | 336 ms | 512 KiB |
#include "towns.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 111;
int cache[MAXN][MAXN];
int dist(int a, int b) {
if (a > b) swap(a, b);
if (a == b) return 0;
if (cache[a][b] != 0) return cache[a][b];
return cache[a][b] = getDistance(a, b);
}
int hubDistance(int n, int sub) {
int r = 1e9;
if (sub == 1) {
for (int i=0; i<n; i++) {
for (int j=i+1; j<n; j++) {
// cerr << endl << endl;
// cerr << "Olhando: " << i << ' ' << j << endl;
map<pair<int, int>, int> mx_dist;
for (int k=0; k<n; k++) {
if (k == i or k == j) continue;
int a = (dist(i, k) + dist(j, k) - dist(i, j)) / 2;
int x = dist(i, k) - a;
int y = dist(j, k) - a;
mx_dist[{x, y}] = max({mx_dist[{x, y}], a, x, y});
// cerr << k << ':' << x << ' ' << y << ' ' << a << endl;
// cerr << dist(i, k) << ' ' << dist(j, k) << ' ' << dist(i, j) << endl;
}
# | 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... |