#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
const ld E = 1e-9;
const int N = 1010;
int n, pre[N], x[N], y[N];
int get(int x) { return (pre[x] == x ? x : pre[x] = get(pre[x])); }
ld sqr(ld x) { return x * x; }
ld dist(int i, int j){
return sqrt(sqr(x[i] - x[j]) + sqr(y[i] - y[j]));
}
bool bigger(ld x, ld y){
return (x - E > y);
}
bool ok(ld x){
for (int i = 0; i < n; i++)
pre[i] = i;
int cnt = n;
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++) {
if (!bigger(dist(i, j), x)){
if (get(i) != get(j)){
cnt--;
pre[get(i)] = get(j);
}
}
}
return (cnt == 1);
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> n;
for (int i = 0; i < n; i++)
cin >> x[i] >> y[i];
ld l = 0, r = ld(2e9);
ok(0);
for (int it = 0; it < 100; it++){
ld md = (l + r) / 2.0;
if (ok(md))
r = md;
else l = md;
}
cout << fixed << setprecision(7) << (trunc(l / 2.0 * 1e7) / 1e7);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
396 KB |
Output isn't correct |
2 |
Incorrect |
9 ms |
364 KB |
Output isn't correct |
3 |
Incorrect |
9 ms |
364 KB |
Output isn't correct |
4 |
Incorrect |
9 ms |
364 KB |
Output isn't correct |
5 |
Incorrect |
9 ms |
364 KB |
Output isn't correct |