codeforces Summer Earnings(bieset)

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.

Sample test(s)
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





 1 //代码心得:用cmp  5178 ms:用运算符重载  1590 ms!!!!
 2 //编程心得:当 边从大到小排完序后  要判断这条边是否
 3 //与之前的边可以构成三角形;可以用bitset  (v[i] & v[j]).any()  
 4 //如果true  说明 存在k  与 i,j都有边   且ki与kj都大于ij!!! 
 5 
 6 
 7 #include<stdio.h>
 8 #include<string.h>
 9 #include<math.h>
10 #include<set>
11 #include<vector>
12 #include<map>
13 #include<queue>
14 #include <cstring>
15 #include <algorithm>
16 #include <cmath>
17 #include <bitset>
18 using namespace std;
19 
20 const int N = 3010;
21 
22 struct node {
23     int d;
24     int i, j;
25        bool operator<(node a) const
26     {
27         return d>a.d;//从大到小!!!! 
28     }
29 }a[N * N];
30 
31 int x[N], y[N];
32 bitset<N> v[N];
33 
34 int main() {
35     int n;
36     scanf("%d", &n);
37     for (int i = 0; i < n; i++) scanf("%d%d", &x[i], &y[i]);
38     int na = 0;
39     for (int i = 0; i < n; i++)
40         for (int j = i + 1; j < n; j++) {
41             a[na].i = i; a[na].j = j;
42             int dx = x[i] - x[j];
43             int dy = y[i] - y[j];
44             a[na].d = dx * dx + dy * dy;
45             na++;
46         }
47     sort(a, a + na);
48     int ans;
49     //for(int i=0;i<na;i++) printf("%.4f**\n", sqrt(a[i].d));
50     for (int k = 0; k < na; k++) {
51         int i = a[k].i, j =  a[k].j;
52         if ((v[i] & v[j]).any()) {
53             ans = a[k].d;
54             break;
55         }
56         v[i][j] = v[j][i] = 1;
57     }
58     printf("%.10f\n", sqrt(ans) * 0.5);
59     return 0;
60 }
View Code

 

转载于:https://www.cnblogs.com/skykill/p/3236355.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
该资源内项目源码是个人的课程设计、毕业设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 该资源内项目源码是个人的课程设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值