#include <bits/stdc++.h>
using namespace std;
int n, say, vis[1005];
double lo = 0, hi = 1e9, lim = 1e-7;
pair<int, int> antenna[1005];
long long uzaklik(pair<int, int> a, pair<int, int> b){
return (long long) abs(a.first - b.first) * abs(a.first - b.first) + (long long) abs(a.second - b.second) * abs(a.second - b.second);
}
void gez(int ind, double r){
vis[ind] = 1;
say++;
for (int i = 0; i < n; i++)
{
if(i != ind && vis[i] == 0 && r * r * 4 > (long long) uzaklik(antenna[ind], antenna[i])){
gez(i, r);
}
}
}
bool check(double r){
memset(vis, 0, sizeof(vis));
say = 0;
gez(0, r);
return say == n;
}
int main(){
cin >> n;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
antenna[i].first = x;
antenna[i].second = y;
}
while(hi - lo > lim){
double mid = (hi + lo) / 2;
if(check(mid)){
hi = mid;
}else{
lo = mid;
}
}
cout.precision(7);
cout << fixed << lo;
//printf("%.7lf", lo);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
2 ms |
204 KB |
Output is correct |
6 |
Correct |
13 ms |
292 KB |
Output is correct |
7 |
Correct |
26 ms |
332 KB |
Output is correct |
8 |
Correct |
41 ms |
296 KB |
Output is correct |
9 |
Correct |
102 ms |
368 KB |
Output is correct |
10 |
Correct |
90 ms |
332 KB |
Output is correct |