#include <bits/stdc++.h>
using namespace std;
typedef pair <double, double> pii;
#define fi first
#define se second
pii cord[1005];
int vis[1005], n, qtd;
double mid;
double dist(pii a, pii b){
return (a.fi - b.fi)*(a.fi - b.fi) + (a.se-b.se)*(a.se-b.se);
}
void dfs(int u){
vis[u] = 1;
qtd++;
for(int i = 0; i<n; i++){
if(vis[i] == 0 && dist(cord[i], cord[u]) < mid*mid) dfs(i);
}
}
double buscab(){
double l = 0, r = 2*1e9;
while(l < r){
mid = (l+r)/2.0;
memset(vis, 0, sizeof(vis));
qtd = 0;
dfs(0);
if(qtd == n) r = mid-1e-9;
else l = mid+1e-9;
}
return l;
}
int main(){
cin >> n;
cout.precision(9);
cout.setf(ios::fixed);
for(int i = 0; i<n; i++) cin >> cord[i].fi >> cord[i].se;
cout << (buscab())/2.0 << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
308 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Execution timed out |
1087 ms |
212 KB |
Time limit exceeded |
6 |
Correct |
14 ms |
340 KB |
Output is correct |
7 |
Correct |
19 ms |
212 KB |
Output is correct |
8 |
Correct |
42 ms |
340 KB |
Output is correct |
9 |
Correct |
79 ms |
352 KB |
Output is correct |
10 |
Execution timed out |
1087 ms |
340 KB |
Time limit exceeded |