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文件下,由于未对变量进 ...
随机推荐
- the grave of my scripts
不定期更新.......... 1,fetch_seq.py https://github.com/freemao/AHRD/blob/master/fetch_seq.py 提取出你想要得染色体的某 ...
- ubuntu默认root密码
安装完Kubuntu后一直都是用我的用户名bbking登录, 一直没想到root的问题, 以为每次sudo输入的密码就是我的root密码. 刚才为了修改文件夹的所有者,想使用su root切换到roo ...
- archlinux设置无线网络连接
Check the driver $ lspci -k Open the network card $ ip link set <设备名> up Check device status $ ...
- Java-->多线程断点续传
--> 在多线程复制的基础上加入断点续传的功能 -->Test 测试类 package com.dragon.java.multithreaddownload; import java.i ...
- Java--接口和类集框架
一.接口 接口是静态常量和抽象方法的集合.也就是说,接口中只能有静态常量和抽象方法. public interface Pet { public static final int A = 10; pu ...
- OpenCV: Canny边缘检测算法原理及其VC实现详解(转载)
原文地址:http://blog.csdn.net/likezhaobin/article/details/6892176 原文地址:http://blog.csdn.net/likezhaobin/ ...
- JS初学之-选项卡(图片切换类)
初学选项卡,主要问题卡在了索引值上面,花了较长的时间学习. 索引值其实很好理解,就是为每一个元素用JS的方法添加一个属性,即自定义属性. 在for循环里的函数里用i,会直接弹出这个数组的length, ...
- qt 获取当前主机的信息
随着科技的发展,嵌入式技术在生活中越来越扮演者重要的角色,小到智能手环.手机,大到智能家居.汽车,都和嵌入式技术息息相关.在嵌入式系统中,拥有良好的用户界面会使产品更具市场优势.最近正好有机会用qt做 ...
- kuangbin_UnionFind J (POJ 2492)
加权并查集mod2模板 本体的难点是bug的释义(笑) #include <iostream> #include <string> #include <cstdio> ...
- Machine and Deep Learning with Python
Machine and Deep Learning with Python Education Tutorials and courses Supervised learning superstiti ...