codeforces Summer Earnings(bieset)
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
//代码心得:用cmp 5178 ms:用运算符重载 1590 ms!!!!
//编程心得:当 边从大到小排完序后 要判断这条边是否
//与之前的边可以构成三角形;可以用bitset (v[i] & v[j]).any()
//如果true 说明 存在k 与 i,j都有边 且ki与kj都大于ij!!! #include<stdio.h>
#include<string.h>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <bitset>
using namespace std; const int N = ; struct node {
int d;
int i, j;
bool operator<(node a) const
{
return d>a.d;//从大到小!!!!
}
}a[N * N]; int x[N], y[N];
bitset<N> v[N]; int main() {
int n;
scanf("%d", &n);
for (int i = ; i < n; i++) scanf("%d%d", &x[i], &y[i]);
int na = ;
for (int i = ; i < n; i++)
for (int j = i + ; j < n; j++) {
a[na].i = i; a[na].j = j;
int dx = x[i] - x[j];
int dy = y[i] - y[j];
a[na].d = dx * dx + dy * dy;
na++;
}
sort(a, a + na);
int ans;
//for(int i=0;i<na;i++) printf("%.4f**\n", sqrt(a[i].d));
for (int k = ; k < na; k++) {
int i = a[k].i, j = a[k].j;
if ((v[i] & v[j]).any()) {
ans = a[k].d;
break;
}
v[i][j] = v[j][i] = ;
}
printf("%.10f\n", sqrt(ans) * 0.5);
return ;
}
codeforces Summer Earnings(bieset)的更多相关文章
- Codeforces 333E Summer Earnings - bitset
题目传送门 传送门I 传送门II 传送门III 题目大意 给定平面上的$n$个点,以三个不同点为圆心画圆,使得圆两两没有公共部分(相切不算),问最大的半径. 显然答案是三点间任意两点之间的距离的最小值 ...
- Codeforces 333E Summer Earnings(bitset)
题目链接 Summer Earnings 类似MST_Kruskal的做法,连边后sort. 然后对于每条边,依次处理下来,当发现存在三角形时即停止.(具体细节见代码) 答案即为发现三角形时当前所在边 ...
- CodeForces 333E. Summer Earnings
time limit per test 9 seconds memory limit per test 256 megabytes input standard input output standa ...
- Codeforces 333E Summer Earnings ——Bitset
[题目分析] 找一个边长最大的三元环. 把边排序,然后依次加入.加入(i,j)时,把i和j取一个交集,看看是否存在,存在就找到了最大的三元环. 输出即可,n^3/64水过. [代码] #include ...
- 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 ...
随机推荐
- Codeforces Round #603 (Div. 2) E. Editor
E. Editor 题目链接: https://codeforces.com/contest/1263/problem/E 题目大意: 输入一个字符串S1含有‘(’ , ‘)’ , ‘R’ , ‘L’ ...
- eclipse jshint安装
http://www.cnblogs.com/lhb25/archive/2012/04/05/javascript-validation-with-jshint-eclipse.html
- [转]Vue项目全局配置微信分享思路详解
这篇文章给大家介绍了vue项目全局配置微信分享思路讲解,使用vue作为框架,使用vux作为ui组件库,具体内容详情大家跟随脚本之家小编一起学习吧 这个项目为移动端项目,主要用于接入公众号服务.项目采用 ...
- canvas万花筒案例
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Ti ...
- 启动tomcat报错One or more listeners failed to start,却找不到任何错误日志的临时解决方案
在整合spring和quartz时,启动tomcat,服务台报以上错误,却找不到任何错误日志…… 参考了https://www.cnblogs.com/sxdcgaq8080/p/8005886.ht ...
- 阶段1 语言基础+高级_1-3-Java语言高级_06-File类与IO流_03 过滤器_1_FileFilter过滤器的原理和使用
FileFilter 需要先定义接口的实现类.并重写过滤的方法 使用 并没有起作用 过滤器的原理 缺少了a.java和b.java 如果是文件夹,就返回true,那么就会返回到Files[]数组中.然 ...
- [转载]OpenSSL中文手册之命令行详解(未完待续)
声明:OpenSSL之命令行详解是根据卢队长发布在https://blog.csdn.net/as3luyuan123/article/details/16105475的系列文章整理修改而成,我自己 ...
- DEDECMS首页,列表页调用自定义图片字段,只显示图片地址
第一步:将自定义字段“图片”类型改为“图片(仅地址)”类型. 第二部:在{dede:arclist row='1' addfields='stu' titlelen='24' orderby='pub ...
- SVG.JS 画弧线
需求描述: 使用svg.js,绘制一个弧线.下图绿色弧线. 准备工作: 1.了解SVG Path中的A指令 详细文档,请戳这里 给定x半径.y半径后,经过指定的两点,可以有2个椭圆,因此两点间有2条弧 ...
- Vue.js 源码学习笔记
最近饶有兴致的又把最新版 Vue.js 的源码学习了一下,觉得真心不错,个人觉得 Vue.js 的代码非常之优雅而且精辟,作者本身可能无 (bu) 意 (xie) 提及这些.那么,就让我来吧:) 程序 ...