#include<bits/stdc++.h>
using namespace std;
long long n, p[1001], limit = 100;
double l = 0, r = 1e9;
pair<int, int> a[1001];
int findparent(int x)
{
if(x == p[x]) return x;
else return p[x] = findparent(p[x]);
}
bool check(double x)
{
for(int i = 1; i <= n; ++i) p[i] = i;
for(int i = 1; i <= n; ++i)
{
for(int j = i + 1; j <= n; ++j)
{
double temp = (abs(a[i].first - a[j].first)) * (abs(a[i].first - a[j].first)) + (abs(a[i].second - a[j].second)) * (abs(a[i].second - a[j].second));
if(sqrt(temp) < x * 2)
{
long long a = findparent(i), b = findparent(j);
p[a] = p[b];
}
}
}
p[1] = findparent(1);
for(int i = 2; i <= n; ++i) if(findparent(i) != p[1]) return 0;
return 1;
}
int main()
{
cin >> n;
for(int i = 1; i <= n; ++i) cin >> a[i].first >> a[i].second;
while(l < r && limit--)
{
double mid = (l + r) / 2;
if(!check(mid)) l = mid;
else r = mid;
}
cout << fixed << setprecision(7) << l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
2 ms |
300 KB |
Output isn't correct |
5 |
Incorrect |
3 ms |
212 KB |
Output isn't correct |
6 |
Correct |
49 ms |
296 KB |
Output is correct |
7 |
Correct |
50 ms |
212 KB |
Output is correct |
8 |
Correct |
101 ms |
304 KB |
Output is correct |
9 |
Incorrect |
500 ms |
312 KB |
Output isn't correct |
10 |
Incorrect |
502 ms |
212 KB |
Output isn't correct |