CodeForces 333E. Summer Earnings

time limit per test
9 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Many schoolchildren look for a job for the summer, and one day, when Gerald was still a schoolboy, he also decided to work in the summer. But as Gerald was quite an unusual schoolboy, he found quite unusual work. A certain Company agreed to pay him a certain sum of money if he draws them three identical circles on a plane. The circles must not interfere with each other (but they may touch each other). He can choose the centers of the circles only from the n options granted by the Company. He is free to choose the radius of the circles himself (all three radiuses must be equal), but please note that the larger the radius is, the more he gets paid.

Help Gerald earn as much as possible.

Input

The first line contains a single integer n — the number of centers (3 ≤ n ≤ 3000). The following n lines each contain two integers xi, yi( - 104 ≤ xi, yi ≤ 104) — the coordinates of potential circle centers, provided by the Company.

All given points are distinct.

Output

Print a single real number — maximum possible radius of circles. The answer will be accepted if its relative or absolute error doesn't exceed 10 - 6.

Examples
input
3
0 1
1 0
1 1
output
0.50000000000000000000
input
7
2 -3
-2 -3
3 0
-3 -1
1 -2
2 -2
-1 0
output
1.58113883008418980000

 

位运算

在点与点之间两两连边,边按边权从大到小排序。

从大到小依次加边,当图中首次出现三元环时,可以画出满足要求的圆,此时加入的这条边/2就是最大半径。

是否出现环可以用bitset位运算判断。

 1 /*by SilverN*/
 2 #include<iostream>
 3 #include<algorithm>
 4 #include<cstring>
 5 #include<cstdio>
 6 #include<cmath>
 7 #include<bitset>
 8 using namespace std;
 9 const int mxn=3030;
10 int read(){
11     int x=0,f=1;char ch=getchar();
12     while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
13     while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
14     return x*f;
15 }
16 struct pt{int x,y;}a[mxn];
17 struct edge{int x,y;double w;
18 }e[mxn*mxn/2];
19 int cmp(const edge a,const edge b){return a.w>b.w;}
20 int ect=0;
21 bitset<3030>b[3030];
22 int n;
23 int main(){
24     int i,j;
25     n=read();
26     for(i=1;i<=n;i++){
27         a[i].x=read();a[i].y=read();
28     }
29     for(i=1;i<n;i++)
30         for(j=i+1;j<=n;j++){
31             e[++ect]=(edge){i,j,sqrt((double)(a[i].x-a[j].x)*(a[i].x-a[j].x)+(a[i].y-a[j].y)*(a[i].y-a[j].y))};
32         }
33     sort(e+1,e+ect+1,cmp);
34     for(i=1;i<=ect;i++){
35         int u=e[i].x,v=e[i].y;
36         if((b[u]&b[v]).any()){
37             printf("%.8f\n",e[i].w/2);return 0;
38         }
39         b[u][v]=1;b[v][u]=1;
40     }
41     return 0;
42 }

 

转载于:https://www.cnblogs.com/SilverNebula/p/6329616.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值