UVaLive 3905 Meteor (扫描线)】的更多相关文章

题意:给定上一个矩形照相机和 n 个流星,问你照相机最多能拍到多少个流星. 析:直接看,似乎很难解决,我们换一个思路,我们认为流星的轨迹就没有用的,我们可以记录每个流星每个流星在照相机中出现的时间段, 然后我们可以枚举时间段么?不行,这个是实数集上的,所以我们用扫描线,就相当于在x轴上有n个区间,我们从左到右拿一个竖线来扫描, 如果找到一个左端点,那么就加1,找到一个右端点就减1,注意,我们在排序时,要先按左端点排,再按右端点,不断更新答案即可, 并用我们可以避免使用浮点数. 代码如下: #pr…
The famous Korean internet company nhn has provided an internet-based photo service which allows The famous Korean internet company users to directly take a photo of an astronomical phenomenon in space by controlling a high-performance telescope owne…
题目 传送门:QWQ 分析 扫描线搞一搞. 按左端点排序,左端点相同时按右端点排序. 如果是左端点就$ cnt++ $,否则$ cnt-- $ 统计一下$ Max $就行了 代码 #include <bits/stdc++.h> using namespace std; void update(int x,int a,int w,double& L,double& R){ if(a==0){ if(x<=0||x>=w) R=L-1; } else if(a>…
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102419#problem/D The famous Korean internet company has provided an internet-based photo service which allows The famous Korean internet company users to directly take a photo of an astronomical p…
The famous Korean internet company nhn has provided an internet-based photo service which allows The famous Korean internet company users to directly take a photo of an astronomical phenomenon in space by controlling a high-performance telescope owne…
给出一些点的初始位置(x, y)及速度(a, b)和一个矩形框,求能同时出现在矩形框内部的点数的最大值. 把每个点进出矩形的时刻分别看做一个事件,则每个点可能对应两个事件,进入事件和离开事件. 按这些事件的发生时间进行排序,然后逐个扫描,遇到进入事件cnt++,遇到离开事件--cnt,用ans记录cnt的最大值. 对时间相同情况的处理,当一个进入事件的时刻和离开事件的时刻相同时,应该先处理离开事件后处理进入事件. 因为速度(a, b)是-10~10的整数,所以乘以LCM(1,2,3,,,10)…
//第一期 计算几何题的特点与做题要领: 1.大部分不会很难,少部分题目思路很巧妙 2.做计算几何题目,模板很重要,模板必须高度可靠. 3.要注意代码的组织,因为计算几何的题目很容易上两百行代码,里面大部分是模板.如果代码一片混乱,那么会严重影响做题正确率. 4.注意精度控制. 5.能用整数的地方尽量用整数,要想到扩大数据的方法(扩大一倍,或扩大sqrt2).因为整数不用考虑浮点误差,而且运算比浮点快. 一.点,线,面,形基本关系,点积叉积的理解 POJ 2318 TOYS(推荐) http:/…
The famous Korean internet company nhn has provided an internet-based photo service which allows The famous Korean internet company users to directly take a photo of an astronomical phenomenon in space by controlling a high-performance telescope owne…
Walk in the Park 题目连接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2222 Descriptionww.co You are responsible for inspecting the trees located in a park, to make sure they remain health…
Strange Antennas Problem's Link: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=87213 Mean: 给你一个N*N的网格,有M个雷达,每个雷达的扫射区域是一个直角边长为P的等腰直角三角形,能够向以直角顶点为中心的四个象限扫射. 雷达之间存在信号屏蔽,只有被奇数个雷达扫射到的区域才能被信号覆盖.求被信号覆盖的区域是多少. analyse: 因为给的都是整数点,这样就不涉及到计算几何了. N…