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 ...
随机推荐
- Java测试笔记(ATM)
本次Java测试主要是做一个与ATM相似的系统,用文本文件来作为用户数据库,实现存款.取款.转账.修改密码.查询余额的功能.在做这次测试之前老师并没有讲解与Java相关的知识,所以这就需要我们自学Ja ...
- SQL读取表中不重复字段
通关关键字 distinct 将AlbumName字段中所以不重复的内容读出来.
- sqlserver高版本往低版本迁移
本例为sql2012 还原到sql2008. 要实现的功能是把sql2012的数据库备份到sql2008,数据库名字为Test,并且这两个数据库在不同的电脑中. 微软的软件设计方案基本上都是新版本兼容 ...
- Vue实现音乐播放器(七):轮播图组件(二)
轮播图组件 <template> <div class="slider" ref="slider"> <div class=&qu ...
- VMware 虚拟化编程(15) — VMware 虚拟机的恢复方案设计
目录 目录 前文列表 将已存在的虚拟机恢复到指定时间点 恢复为新建虚拟机 灾难恢复 恢复细节 恢复增量备份数据 以 RDM 的方式创建虚拟磁盘 创建虚拟机 Sample of VirtualMachi ...
- IIS 配置备份和还原
首先我们打开服务器管理器,一般服务器都在左下角的任务栏中,直接点击即可打开 图1 打开WEB服务器(IIS),选择IIS根目录,找到右边的共享管理 图2 打开共享管理后,我们在右侧的操作中找到导出配置 ...
- UI自动化之特殊处理一(iframe\句柄\鼠标键盘)
iframe\句柄\鼠标键盘是一些比较特殊的事件,需要特殊处理 目录 1.iframe 2.句柄(handle) 3.鼠标键盘 1.iframe iframe 是内嵌的网页元素,也可以说是内嵌的框架, ...
- 《Using Python to Access Web Data》 Week3 Networks and Sockets 课堂笔记
Coursera课程<Using Python to Access Web Data> 密歇根大学 Week3 Networks and Sockets 12.1 Networked Te ...
- Arduino入门之前
胡乱乱的,就买了,这个 arduino的板子. 哎...本来明明是 学动漫的,然后 不小心就开始 做软件了,然后 越跑越偏...现在 开始 做 硬件开发了... 其实 还有 树莓派 可供选择,算了,不 ...
- 并查集入门(hdu1232“畅通工程”)
在学习并查集之前,首先需要明白基本的并查集可以完成的功能.并查集主要是用于处理不相交集合的合并问题.它是一种基础算法,在离散数学中,可以利用并查集求一个图的连通分支,利用其这个特性可以为我们解决一系列 ...