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文件下,由于未对变量进 ...
随机推荐
- log4j 应用
前言: 该片文章旨在对于刚入门的log4j学习的同学们,看完这篇,应该可以提高了. 主要内容还是根据log4j的配置文件中的各个配置来进行解析 正文: log4j 使用参数 log4j配置文件示例: ...
- Android中GC_EXTERNAL_ALLOC的含义
GC_FOR_MALLOC means that the GC was triggered because there wasn't enough memory left on the heap to ...
- Notes of Linked Data concept and application - TODO
Motivation [反正债多了不愁,再开个方向.] Data plays a core role in most business systems, data storage and retrie ...
- CentOS6.3 Hostname设定修改
今天装了个CentOS6.3恩,基本上是参照百度文库上面的文章来安装的 http://wenku.baidu.com/link?url=K0tqotryKLFHhJGicx1nC-hsgfWhL3OI ...
- STL概述
一.关于STL STL(Standard Template Library,标准模板库)是C++语言标准中的重要组成部分.STL 以模板类和模板函数的形式为程序员提供了各种数据结构和算法的精巧实现,程 ...
- hihoCoder #1033 : 交错和 (数位Dp)
题目大意: 给定一个数 x,设它十进制展从高位到低位上的数位依次是 a0, a1, ..., an - 1,定义交错和函数: f(x) = a0 - a1 + a2 - ... + ( - 1)n - ...
- hihoCoder #1078 : 线段树的区间修改
题目大意及分析: 线段树成段更新裸题. 代码如下: # include<iostream> # include<cstdio> # include<cstring> ...
- Oracle学习系列1
两个服务必须启动: OracleOraDb10g*TNListener 和 OracleService*** 使用sqlplusw先进行环境的设置 set linesize 300 ; set pag ...
- ExtJS-Viewport背景图片铺满浏览器视图并自动伸缩
var viewport = Ext.create('Ext.container.Viewport', { style : 'background-image:url(login_bj.jpg);ba ...
- MFC中使用Duilib--2
在上一篇文章"MFC中使用Duilib--1"中, 没有用到资源文件,即xml,本篇讲怎样加载文件. 1. 在exe输出目录下,创建一个skin目录,里面放入需要用到的图片文件, ...