bzoj1536: [POI2005]Akc- Special Forces Manoeuvres
Description
Input
Output
#include<cstdio>
#include<cmath>
typedef long double ld;
const ld _0=1e-;
ld x[],y[],r[];
void get(int id,ld X,ld&a,ld&b){
X-=x[id];
X=std::sqrt(r[id]*r[id]-X*X);
a=y[id]-X-_0;
b=y[id]+X+_0;
}
ld dis(int a,int b){
ld X=x[a]-x[b],Y=y[a]-y[b];
return sqrt(X*X+Y*Y);
}
ld cal(int a,int b){
return x[a]+(x[b]-x[a])*r[a]/dis(a,b);
}
bool chk(int n){
ld L=x[]-r[],R=x[]+r[],M;
for(int i=;i<=n;++i){
if(x[i]-r[i]<L)L=x[i]-r[i];
if(x[i]+r[i]>R)R=x[i]+r[i];
}
while(){
M=(L+R)/;
bool dl=,dr=;
for(int i=;i<=n;++i){
if(x[i]+r[i]<M)dl=;
if(x[i]-r[i]>M)dr=;
}
if(dl){
if(dr)return ;
R=M;
}else if(dr)L=M;
else{
ld y1,y2,a1,a2;
get(,M,y1,y2);
for(int i=;i<=n;++i){
get(i,M,a1,a2);
if(a1>y1)y1=a1;
if(a2<y2)y2=a2;
if(y1>y2){
for(int j=;j<i;++j){
get(j,M,y1,y2);
if(y1>a2||y2<a1){
if(dis(i,j)>r[i]+r[j]+_0)return ;
ld xm=cal(i,j);
if(xm>R||xm<L)return ;
if(M<xm)L=M;
else R=M;
goto out;
}
}
}
}
return ;
}
out:;
}
}
int main(){
int n;
scanf("%d",&n);
for(int i=;i<=n;++i)scanf("%llf%llf%llf",x+i,y+i,r+i),r[i]+=_0;
if(chk(n))return puts("NIE"),;
int L=,R=n,M;
while(L<R){
M=L+R>>;
if(chk(M))L=M+;
else R=M;
}
return printf("%d",L),;
}
bzoj1536: [POI2005]Akc- Special Forces Manoeuvres的更多相关文章
- 「题解」POI2005 AKC-Special Forces Manoeuvres
本文将同步发布于: 洛谷博客: csdn: 博客园: 简书. 题目 题目链接:洛谷 P3428.官网. 题意简述 给定 \(n\) 个圆 \((x_i,y_i,r_i)\),每个圆对应一个点集 \(S ...
- bzoj AC倒序
Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem ...
- China-global view
Good morning everyone. Everyone here would know this year Xia’Men held the BRICS business forum.In a ...
- China’s movie heroes 《红海行动》展现中国英雄本色
Recent years have seen a trend for big military movies. Whether it was last year’s British hit Dunki ...
- 思维题--code forces round# 551 div.2
思维题--code forces round# 551 div.2 题目 D. Serval and Rooted Tree time limit per test 2 seconds memory ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- bzoj 1537: [POI2005]Aut- The Bus 线段树
bzoj 1537: [POI2005]Aut- The Bus 先把坐标离散化 设f[i][j]表示从(1,1)走到(i,j)的最优解 这样直接dp::: f[i][j] = max{f[i-1][ ...
- (转载)phpcms v9两步实现专题栏目生成路径去掉html和special
相信很多人都知道,phpcms v9专题是不支持自定义URL的,生成的专题路径是以/HTML/special/开头的.那么如何实现专题栏目生成路径去掉html和special呢?通过修改程序的PHP源 ...
- QIBO CMS SQL Injection Via Variable Uninitialization In \member\special.php
Catalog . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 该漏洞存在于/member/special.php文件下,由于未对变量进 ...
随机推荐
- dalvik虚拟内存管理之三——调试信息
转载自http://www.miui.com/thread-75063-1-1.html 1. verbosegc一般Java虚拟机要求支持verbosegc选项,输出详细的垃圾收集调试信息.dalv ...
- keynotes egestas,PPT 渐变背景下载-imsoft.cnblogs
- UVa 10747 - Maximum Subsequence
题目大意:给出n个数,从中选取k个,使得乘积最大,并且尽量使和最大 分析:首先按照数的绝对值大小排序.然后就要分三大类情况讨论: (1)前k个中选到0:如果选到0的话,乘积一定是0,所以尽量选大的数, ...
- ZMMR103-数据批量导入
************************************************************************ Title : ZMMR103 ** Applicat ...
- 下载abap 源代码
转自http://blog.sina.com.cn/s/blog_4d1570de0100pvhd.html *@------------------------------------------- ...
- 网络延迟查看器 Network latency view 1.4
这是个用于查看网络延迟/ip/主机/地区的工具,内外网通吃,外网可通过这里下载csv以显示国家(地区) 可以自己决定winpcap或者原始套接字进行捕捉 如果只扫描内网推荐angryip 这是款发布在 ...
- leetcode 142. Linked List Cycle II ----- java
Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note ...
- Javascript对象属性与方法汇总
Javascript对象属性与方法汇总 发布时间:2015-03-06 编辑:www.jquerycn.cn 详细介绍下,javascript对象属性与对象方法的相关知识,包括javascript字符 ...
- 越狱Season 1-Episode 2: Allen
Season 1, Episode 2: Allen [Previously, on Prison Break] previously: 以前(预先) 前情回顾 -Judge: I find it i ...
- docker学习3-虚拟网络模式
一.虚拟机网络模式 在理解docker网络隔离前,先看下之前虚拟机里对网络的处理,VirtualBox中有4中网络连接方式: NAT Bridged Adapter Internal Host-onl ...