# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20194 | suhgyuho_william | Towns (IOI15_towns) | C++98 | 21 ms | 4 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 <algorithm>
using namespace std;
int R;
int a[150][150];
int hubDistance(int N, int sub) {
int i,x;
int v,big;
for(i=1; i<N; i++) a[0][i] = a[i][0] = getDistance(0,i);
big = 0;
for(i=1; i<N; i++){
if(big < a[0][i]){
big = a[0][i];
v = i;
}
}
for(i=1; i<N; i++){
if(i == v) continue;
a[v][i] = a[i][v] = getDistance(i,v);
}
R = 0;
for(i=1; i<N; i++){
if(i == v) continue;
x = a[0][i]+a[v][i]-big;
x /= 2;
R = max(R,max(a[0][i]-x,a[v][i]-x));
}
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... |