#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
pair <ll, ll> a[1001];
ll dist (int x, int y) {
return (a[x].first - a[y].first) * (a[x].first - a[y].first) + (a[x].second - a[y].second) * (a[x].second - a[y].second);
}
ll b[1001]; bool vis[1001]; const ll inf = 1e18;
int main () {
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i].first >> a[i].second;
for (int i = 1; i <= n; i++) b[i] = inf - 1;
ll mx = 0;
for (int i = 1; i <= n; i++) {
ll pos = -1, mn = inf;
for (int j = 1; j <= n; j++) {
if (vis[j]) continue;
if (b[j] < mn) {
mn = b[j];
pos = j;
}
}
if (i != 1) mx = max(mx, b[pos]);
vis[pos] = 1;
for (int j = 1; j <= n; j++) {
if (!vis[j]) {
b[j] = min(b[j], dist(pos, j));
}
}
}
cout << fixed << setprecision(7) << sqrt(mx) / 2 << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
2 ms |
348 KB |
Output is correct |
9 |
Correct |
3 ms |
348 KB |
Output is correct |
10 |
Correct |
4 ms |
348 KB |
Output is correct |