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文件下,由于未对变量进 ...
随机推荐
- C语言redirection
1)把执行文件xxx.exe 和读取的文件yyy.txt放在一个地方 2)用dos 命令 dir 和cd,打开存放文件的文件夹 3)window 7 情况下 输入xxx.exe < yyy.tx ...
- 第四部分:python性能技巧
4.1 查询操作为主时,选择字典结构比list结构效率更高 4.2 取list的交集.并集.差集时,可借助set数据结构如listintersection = list(set(lista)& ...
- Codeforces Round #365 (Div. 2) B 前缀和
B. Mishka and trip time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- ZOJ 1090 The Circumference of the Circle
原题链接 题目大意:已知三角形的三个顶点坐标,求其外接圆的周长. 解法:刚看到这道题时,马上拿出草稿纸画图,想推导出重心坐标,然后求出半径,再求周长.可是这个过程太复杂了,写到一半就没有兴致了,还是求 ...
- matlab演奏《卡农》
% Cripple Pachebel’s Canon on Matlab% Have fun fs = 44100; % sample ratedt = 1/fs; T16 = 0.125; t16 ...
- ubuntu 以root 运行程序
body{ font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI& ...
- timus 1106 Two Teams(二部图)
Two Teams Time limit: 1.0 secondMemory limit: 64 MB The group of people consists of N members. Every ...
- JAVA常用关键字
Java 中常用关键字: 一一解释(先以印象注明含义,若有错误或未填写的待用到后补充.更新):(蓝色为不确定部分) abstract : 虚类 boolean : 类型定义——布尔型 break : ...
- 系统镜像以及微PE工具箱
微PE地址:http://www.wepe.com.cn/download.html MSDN镜像下载地址:http://msdn.itellyou.cn/ 小白也能轻松装系统(win10 64位) ...
- php get set方法深入理解
在类当中,设计通用的set和get方法,可以简化对属性的读写,这种方法不同于针对于独立的属性的普通的get和set方法,后者针对每个属性,都必须提供一对方法,前者针对所有属性,因此,可以看作是批量定义 ...