博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu 2295(DLX+二分)
阅读量:6820 次
发布时间:2019-06-26

本文共 2841 字,大约阅读时间需要 9 分钟。

用了点离散化的处理, 然后二分一下就可以了。。。

Radar

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1928    Accepted Submission(s): 796

Problem Description
N cities of the Java Kingdom need to be covered by radars for being in a state of war. Since the kingdom has M radar stations but only K operators, we can at most operate K radars. All radars have the same circular coverage with a radius of R. Our goal is to minimize R while covering the entire city with no more than K radars.
 

 

Input
The input consists of several test cases. The first line of the input consists of an integer T, indicating the number of test cases. The first line of each test case consists of 3 integers: N, M, K, representing the number of cities, the number of radar stations and the number of operators. Each of the following N lines consists of the coordinate of a city. Each of the last M lines consists of the coordinate of a radar station.
All coordinates are separated by one space. Technical Specification
1. 1 ≤ T ≤ 20 2. 1 ≤ N, M ≤ 50 3. 1 ≤ K ≤ M 4. 0 ≤ X, Y ≤ 1000
 

 

Output
For each test case, output the radius on a single line, rounded to six fractional digits.
 

 

Sample Input
1 3 3 2 3 4 3 1 5 4 1 1 2 2 3 3
 

 

Sample Output
2.236068
 

 

Source
 

 

Recommend
lcy
 
#include 
#include
#include
#include
#include
using namespace std;#define N 10000#define INF 0x3fffffffstruct node{ double x,y;}gn[55],gm[55];int n,m,k;int U[N],D[N],R[N],L[N],num[N],H[N],col[N],line[N];int head,id,mi;int nn,mm;double g[N];double cal(node t,node t1){ return sqrt( (t.x-t1.x)*(t.x-t1.x)+(t.y-t1.y)*(t.y-t1.y) );}void prepare(){ for(int i=0;i<=mm;i++) { num[i]=0; U[i]=i; D[i]=i; R[i]=i+1; L[i+1]=i; } R[mm]=0; L[0]=mm; memset(H,-1,sizeof(H));}void link(int tn,int tm){ id++; num[line[id]=tm]++; col[id]=tn; U[D[tm]]=id; D[id]=D[tm]; U[id]=tm; D[tm]=id; if( H[tn]<0 ) H[tn]=R[id]=L[id]=id; else { L[R[H[tn]]]=id; R[id]=R[H[tn]]; L[id]=H[tn]; R[H[tn]]=id; }}int h(){ int mark[66]; memset(mark,0,sizeof(mark)); int sum=0; for(int i=R[head];i!=head;i=R[i]) { if(mark[i]==0) { sum++; mark[i]=1; for(int j=D[i];j!=i;j=D[j]) for(int k=R[j];k!=j;k=R[k]) mark[ line[k] ]=1; } } return sum;}void remove(int s){ for(int i=D[s];i!=s;i=D[i]) { R[L[i]]=R[i]; L[R[i]]=L[i]; }}void resume(int s){ for(int i=U[s];i!=s;i=U[i]) R[L[i]]=L[R[i]]=i;}void dfs(int s){ if(s+h()>=mi) return ; if(R[head]==head) { mi=s; return ; } int tmi=INF,tu; for(int i=R[head];i!=head;i=R[i]) { if(num[i]

 

转载地址:http://jkszl.baihongyu.com/

你可能感兴趣的文章
MySQL 中 整数类型的存储和范围计算过程详解
查看>>
堡垒跳板机实现——架构实现
查看>>
为 Blade 模板引擎添加新文件扩展名
查看>>
时间戳防盗链鉴权php实现
查看>>
Laravel 中使用 Vue 组件化开发(配置)
查看>>
[LintCode/LeetCode] Subsets & Subsets II
查看>>
iOS 客户端基于 WebP 图片格式的流量优化(上)
查看>>
gulp+webpack工作流探索
查看>>
spring-mvc的Conveter和Formatter
查看>>
BackBone
查看>>
django rest framework 自定义用户以及自定义认证方式
查看>>
JSON.stringify 函数参数分析
查看>>
css 预编译器的再次理解
查看>>
[LintCode] Backpack I & II
查看>>
Puppet安装配置小结
查看>>
AFNetworking详解(1)
查看>>
VirtualBox 虚拟机界面显示太小
查看>>
成为运维界的「福尔摩斯」,你还需要3个帮手!
查看>>
PHP、Android、iOS 的恩恩怨怨
查看>>
记一次 MySQL 数据库问题排查
查看>>