# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
119476 | sealnot123 | Towns (IOI15_towns) | C++14 | 20 ms | 504 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.
#ifdef LOCAL
#include "grader.cpp"
#endif
#include "towns.h"
#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(),(a).end()
#define SZ(a) (int)(a).size()
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
typedef double D;
typedef long double LD;
const int N=115;
int dist[N][N];
int hubDistance(int n, int sub) {
int R = 1<<30;
memset(dist, 0, sizeof dist);
int a,b,c,d,e,i,j,k,l;
a = 0; c = 0;
for(i=1;i<n;i++){
b = getDistance(0, i);
if(b > a) a = b, c = i;
}
a = 0;
for(i=0;i<n;i++){
if(i==c) continue;
dist[c][i] = getDistance(c, i);
if(dist[c][i] > a) a = dist[c][i], d = i;
}
for(i=0;i<n;i++){
if(i==d) continue;
dist[d][i] = getDistance(d, i);
}
for(i=0;i<n;i++){
if(i==c || i==d) continue;
a = (dist[c][i] + dist[d][i] - dist[c][d])>>1;
R = min(R, max(dist[c][i], dist[d][i]) - a);
}
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... |