CodeForces 333E. Summer Earnings
9 seconds
256 megabytes
standard input
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.
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.
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.
3
0 1
1 0
1 1
0.50000000000000000000
7
2 -3
-2 -3
3 0
-3 -1
1 -2
2 -2
-1 0
1.58113883008418980000
位运算
在点与点之间两两连边,边按边权从大到小排序。
从大到小依次加边,当图中首次出现三元环时,可以画出满足要求的圆,此时加入的这条边/2就是最大半径。
是否出现环可以用bitset位运算判断。
/*by SilverN*/
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<bitset>
using namespace std;
const int mxn=;
int read(){
int x=,f=;char ch=getchar();
while(ch<'' || ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>='' && ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
struct pt{int x,y;}a[mxn];
struct edge{int x,y;double w;
}e[mxn*mxn/];
int cmp(const edge a,const edge b){return a.w>b.w;}
int ect=;
bitset<>b[];
int n;
int main(){
int i,j;
n=read();
for(i=;i<=n;i++){
a[i].x=read();a[i].y=read();
}
for(i=;i<n;i++)
for(j=i+;j<=n;j++){
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))};
}
sort(e+,e+ect+,cmp);
for(i=;i<=ect;i++){
int u=e[i].x,v=e[i].y;
if((b[u]&b[v]).any()){
printf("%.8f\n",e[i].w/);return ;
}
b[u][v]=;b[v][u]=;
}
return ;
}
CodeForces 333E. Summer Earnings的更多相关文章
- Codeforces 333E Summer Earnings - bitset
题目传送门 传送门I 传送门II 传送门III 题目大意 给定平面上的$n$个点,以三个不同点为圆心画圆,使得圆两两没有公共部分(相切不算),问最大的半径. 显然答案是三点间任意两点之间的距离的最小值 ...
- Codeforces 333E Summer Earnings(bitset)
题目链接 Summer Earnings 类似MST_Kruskal的做法,连边后sort. 然后对于每条边,依次处理下来,当发现存在三角形时即停止.(具体细节见代码) 答案即为发现三角形时当前所在边 ...
- Codeforces 333E Summer Earnings ——Bitset
[题目分析] 找一个边长最大的三元环. 把边排序,然后依次加入.加入(i,j)时,把i和j取一个交集,看看是否存在,存在就找到了最大的三元环. 输出即可,n^3/64水过. [代码] #include ...
- codeforces Summer Earnings(bieset)
Summer Earnings time limit per test 9 seconds memory limit per test 256 megabytes input standard inp ...
- Codeforces 1107G Vasya and Maximum Profit 线段树最大子段和 + 单调栈
Codeforces 1107G 线段树最大子段和 + 单调栈 G. Vasya and Maximum Profit Description: Vasya got really tired of t ...
- CF333E Summer Earnings
CF333E Summer Earnings 题目 https://codeforces.com/problemset/problem/333/E 题解 思路 知识点:枚举,图论,位运算. 题目要求从 ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
随机推荐
- iOS跳转到各种系统设置界面
定位服务 定位服务有很多APP都有,如果用户关闭了定位,那么,我们在APP里面可以提示用户打开定位服务.点击到设置界面设置,直接跳到定位服务设置界面.代码如下: //定位服务设置界面 NSURL *u ...
- 【NOIP2017提高组模拟7.3】B
树上路径统计,点分治解决. 统计一段区间,naive地用了set解决,这样的复杂度是O(nlog^2n)的 考场代码出了个问题,统计答案时找到了之前的最优答案,但是没有加上新的一段,导致60分 #in ...
- cephfs 挂载 卸载
#挂载 sudo ceph-fuse -m 10.1.xx.231:6789,10.1.xx.232:6789,10.1.xx.233:6789 -r /MySQL-BK /data/backup # ...
- IntelliJ IDEA 配置 Tomcat 运行web项目
运行前提: 配置好 Java 的运行环境 配置好 Tomcat 安装 IntelliJ IDEA 开始 1.创建项目并配置 关于配置SDK,等建完项目再说 没有配置SDK的话 会出现下面的弹框,点击 ...
- LVS-nat模式-原理介绍
集群,为解决某个特定问题将多台计算机组合起来形成的单个系统 lvs-nat: 本质是多目标IP的DNAT,通过将请求报文中的目标地址和目标端口修改为某挑出的RS的RIP和PORT实现转发 lvs集群类 ...
- linux的一些权限的操作 chmod
u ---属主 g ---用户组 o ---其他组 + ----赋予权限 - ----取消权限 = ----赋予权限并取消以前的权限 r = 4 //读 w =2 //写 x =1 //执 ...
- Python基础——文件操作
写文件 writefile %%writefile ./data/testFile.txt hello python jin tian tian qi bu cuo open覆盖 txt=open(' ...
- spring事务(Transaction )报 marked as rollback-only异常的原因及解决方法
很多朋友在使用spring+hibernate或mybatis等框架时经常遇到报Transaction rolled back because it has been marked as rollba ...
- window 7上安装Visual Studio 2017失败的解决方法
今天在办公电脑上windows 7系统上装Visual Studio 2017企业版的时候遇到了一个让人懵逼的错误. 为啥说懵逼呢,因为昨天楼主在台式机上同样安装2017没有任何问题啊,台式机上是wi ...
- Django one
WEB-Django: Http协议: http协议:超文本传输协议,基于TCP/IP通信协议来传递数据 特点: 1.灵活:允许传输任意类型的数据对象.正在传输的类型有Content-Type标记 2 ...