博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
POJ 1328 Radar Installation 贪心
阅读量:7121 次
发布时间:2019-06-28

本文共 1359 字,大约阅读时间需要 4 分钟。

把每个点转成区间,排序,首先考虑最左边的区间[l1,r1],要覆盖住这个点则需要在这个区间里的某个位置x放一个雷达,显然尽量放在靠右端是最好的,因为可以同时被右边的其他区间覆盖,但是要被右边的区间[l2,r2]覆盖还需满足l2<=x<=r2,所以要x=min(x,r2)更新x的值。

//#pragma comment(linker, "/STACK:1024000000,1024000000")#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair
pii;#define pb(a) push(a)#define INF 0x1f1f1f1f#define lson idx<<1,l,mid#define rson idx<<1|1,mid+1,r#define PI 3.1415926535898template
T min(const T& a,const T& b,const T& c) { return min(min(a,b),min(a,c));}template
T max(const T& a,const T& b,const T& c) { return max(max(a,b),max(a,c));}void debug() {#ifdef ONLINE_JUDGE#else freopen("in.txt","r",stdin); //freopen("d:\\out1.txt","w",stdout);#endif}int getch() { int ch; while((ch=getchar())!=EOF) { if(ch!=' '&&ch!='\n')return ch; } return EOF;}const int maxn = 10005;const double eps = 10e-8;typedef pair
pdd;pdd da[maxn];double cal(int x,int y,int R){ if(abs(y)>R)return -1; return sqrt(R*R-y*y)+eps;}int main(){ int n,R; int ca=0; while(scanf("%d%d",&n,&R)!=EOF&&(n||R)) { int sol=1; for(int i=0;i
View Code

 

转载于:https://www.cnblogs.com/BMan/p/3650031.html

你可能感兴趣的文章
趣题一则:寻找那扇门
查看>>
Oracle AWR报告提取方法
查看>>
好奇:WayOs破解、OEM、修复、打包等工具大全,满足大家的好奇心发下截图
查看>>
How to use kingshard building a MySQL cluster
查看>>
HibernateAnnotation入门实例
查看>>
iOS 基础介绍 1
查看>>
Qt 快捷键
查看>>
SAP HANA创建类型(SAP HANA CREATE TYPE):
查看>>
深入浅出CChart 每日一课——第十六课 实习之旅,百年老店之新锐WTL
查看>>
Signal Handling--ref
查看>>
SkinSharp用法
查看>>
大抚州泡粉
查看>>
【RMQ问题】求数组区间最大值,NYOJ-1185-最大最小值
查看>>
简易实现 TextView单行文本水平触摸滑动效果
查看>>
android调用系统相机拍照并保存在本地
查看>>
Node.js链式回调
查看>>
IOS中延时执行的几种方式的比较
查看>>
sql中having、group by用法及常用聚合函数
查看>>
用swift开发仪表盘控件(一)
查看>>
使用CAShapeLayer与UIBezierPath画出想要的图形
查看>>