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文件下,由于未对变量进 ...
随机推荐
- XACT_ABORT 用法
首先创建一张表 Create Table TranTable( Id INT IDENTITY(1,1) PRIMARY KEY, Priority TINYINT--最大值255) 1. ...
- 完全搞懂傅里叶变换和小波(1)——总纲<转载>
无论是学习信号处理,还是做图像.音视频处理方面的研究,你永远避不开的一个内容,就是傅里叶变换和小波.但是这两个东西其实并不容易弄懂,或者说其实是非常抽象和晦涩的! 完全搞懂傅里叶变换和小波,你至少需要 ...
- html中怎么去掉input获取焦点时候的边框
如图 这个是在360浏览器极速模式下的效果 有个颜色的边框,,但是在兼容模式下就可以的呢 看看兼容模式下的效果 很显然 上面那个被高亮了,焦点的时候有边框 要怎么弄才能让他始终没有边框呢 2014 ...
- Roman to Integer
Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 t ...
- 新浪代码部署手册 git管理工具
目前新浪云上的应用支持通过Git和SVN来部署代码. Git仓库地址 https://git.sinacloud.com/YOUR_APP_NAME SVN仓库地址 https://svn.sinac ...
- ThinkPHP使用SQL函数进行查询
//SQL函数查询 $products=$pro->where(array("FIND_IN_SET('".$type."',type)",'num'=& ...
- Hightchart.js 的使用
中文网址介绍 http://www.hcharts.cn/docs/basic-zoom http://v1.hcharts.cn/demo/index.php?p=46
- DEBUG MYSQL
https://dev.mysql.com/doc/refman/5.7/en/porting.html https://dev.mysql.com/doc/refman/5.7/en/debuggi ...
- Hadoop SPARK 环境搭建
http://www.linuxidc.com/Linux/2015-02/113486.htm http://www.cnblogs.com/lijingchn/p/5574476.html htt ...
- jquery mouseout事件错误(bug)
移到子元素上时(例如,处在div中的图像),触发移出事件 (mouseout事件的一个常见错误). 解决办法是使用hover事件 在使用hover事件前,我抓耳挠腮的以为是margin或padding ...