[POI 2001+2014acm上海邀请赛]Gold Mine/Beam Cannon 线段树+扫描线

通过将二维平面上的点转化为线段并进行扫描线处理,利用线段树数据结构,求解在给定矩形面积下能包含最多点的矩形位置,将复杂度降低到O(n*log(A)),其中n为点的数量,A为点纵坐标的范围。
摘要由CSDN通过智能技术生成
Description 

Byteman, one of the most deserving employee of The Goldmine of Byteland, is about to retire by the end of the year. The Goldmine management would like to reward him in acknowledgment of his conscientious work. As a reward Byteman may receive a small lot - a rectangular piece of the mine's area with sides of length s and w parallel to the axes of the coordinate system. He may choose the location of the lot. Of course, a value of the lot depends on the location. The value of the lot is a number of gold nuggets in the area of the lot (if a nugget lies on the border of the lot, then it is in the area of the lot). Your task is to write a program which computes the maximal possible value of the lot (the value of the lot with the best location). In order to simplify we assume that the terrain of the Goldmine is boundless, but the area of gold nuggets occurrence is limited. 

Task
Write a program which:

1.reads the location of gold nuggets, 
2.computes the maximal value of a lot (i.e. the maximal number of gold nuggets on the lot of given size), 
3.writes the result . 
Input 

In the first line there are two pos
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值