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 rep(i,a,b) for(int i = (a); i <= (b); i++)
#define debug(a) cerr << #a << " = " << a << endl
int largo[112];
int hubDistance(int N, int sub) {
int a,b,res,c,dis,x;
rep(i,0,110) largo[i] = 0;
a = 0;
x = 0;
rep(i,1,N-1) {
b = abs(getDistance(0,i));
if (b > x) {
a = i;
x = b;
}
}
b = 0;
x = 0;
rep(i,0,N-1) {
if (i != a) {
largo[i] = abs(getDistance(a,i));
if (largo[i] > x) {
b = i;
x = largo[i];
}
}
}
dis = largo[b];
res = 1000001;
rep(i,0,N-1) {
if (i != b && i != a) {
c = abs(getDistance(i,b) - largo[i]);
if (c < res) res = c;
}
}
res = (dis+res)/2;
cerr << res;
return res;
}
Compilation message (stderr)
towns.cpp: In function 'int hubDistance(int, int)':
towns.cpp:9:28: warning: unused parameter 'sub' [-Wunused-parameter]
9 | int hubDistance(int N, int sub) {
| ~~~~^~~
# | 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... |