【POJ2482】【线段树】Stars in Your Window
Description
These days, having parted with friends, roommates and classmates one
after another, I still cannot believe the fact that after waving hands,
these familiar faces will soon vanish from our life and become no more
than a memory. I will move out from school tomorrow. And you are
planning to fly far far away, to pursue your future and fulfill your
dreams. Perhaps we will not meet each other any more if without fate and
luck. So tonight, I was wandering around your dormitory building hoping
to meet you there by chance. But contradictorily, your appearance must
quicken my heartbeat and my clumsy tongue might be not able to belch out
a word. I cannot remember how many times I have passed your dormitory
building both in Zhuhai and Guangzhou, and each time aspired to see you
appear in the balcony or your silhouette that cast on the window. I
cannot remember how many times this idea comes to my mind: call her out
to have dinner or at least a conversation. But each time, thinking of
your excellence and my commonness, the predominance of timidity over
courage drove me leave silently.
Graduation, means the end of life in university, the end of these
glorious, romantic years. Your lovely smile which is my original
incentive to work hard and this unrequited love will be both sealed as a
memory in the deep of my heart and my mind. Graduation, also means a
start of new life, a footprint on the way to bright prospect. I truly
hope you will be happy everyday abroad and everything goes well.
Meanwhile, I will try to get out from puerility and become more
sophisticated. To pursue my own love and happiness here in reality will
be my ideal I never desert.
Farewell, my princess!
If someday, somewhere, we have a chance to gather, even as
gray-haired man and woman, at that time, I hope we can be good friends
to share this memory proudly to relight the youthful and joyful
emotions. If this chance never comes, I wish I were the stars in the sky
and twinkling in your window, to bless you far away, as friends, to
accompany you every night, sharing the sweet dreams or going through the
nightmares together.

Here comes the problem: Assume the sky is a flat plane. All the
stars lie on it with a location (x, y). for each star, there is a grade
ranging from 1 to 100, representing its brightness, where 100 is the
brightest and 1 is the weakest. The window is a rectangle whose edges
are parallel to the x-axis or y-axis. Your task is to tell where I
should put the window in order to maximize the sum of the brightness of
the stars within the window. Note, the stars which are right on the edge
of the window does not count. The window can be translated but rotation
is not allowed.
Input
are several test cases in the input. The first line of each case
contains 3 integers: n, W, H, indicating the number of stars, the
horizontal length and the vertical height of the rectangle-shaped
window. Then n lines follow, with 3 integers each: x, y, c, telling the
location (x, y) and the brightness of each star. No two stars are on the
same point.
There are at least 1 and at most 10000 stars in the sky. 1<=W,H<=1000000, 0<=x,y<2^31.
Output
Sample Input
3 5 4
1 2 3
2 3 2
6 3 1
3 5 4
1 2 3
2 3 2
5 3 1
Sample Output
5
6
Source
/*
唐代杜甫
《前出塞九首·其六》
挽弓当挽强,用箭当用长。射人先射马,擒贼先擒王。
杀人亦有限,列国自有疆。苟能制侵陵,岂在多杀伤。
*/
【POJ2482】【线段树】Stars in Your Window的更多相关文章
- 【POJ-2482】Stars in your window 线段树 + 扫描线
Stars in Your Window Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11706 Accepted: ...
- 【POJ2482】Stars in Your Window(线段树,扫描线)
题意:在二维坐标系中有一些带权值的点,要求用一个长宽指定不能互换的框套住其中的一些,使得它们的权值和最大. n<=10000 x,y<=2^31 思路:首先按X排序,将Y坐标离散化,X坐标 ...
- POJ 2482 Stars in Your Window 线段树扫描线
Stars in Your Window Description Fleeting time does not blur my memory of you. Can it really be 4 ...
- POJ 2482 Stars in Your Window(线段树)
POJ 2482 Stars in Your Window 题目链接 题意:给定一些星星,每一个星星都有一个亮度.如今要用w * h的矩形去框星星,问最大能框的亮度是多少 思路:转化为扫描线的问题,每 ...
- poj 2482 Stars in Your Window + 51Nod1208(扫描线+离散化+线段树)
Stars in Your Window Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13196 Accepted: ...
- 【POJ 2482】 Stars in Your Window(线段树+离散化+扫描线)
[POJ 2482] Stars in Your Window(线段树+离散化+扫描线) Time Limit: 1000MS Memory Limit: 65536K Total Submiss ...
- POJ 2482 Stars in Your Window (线段树+扫描线+区间最值,思路太妙了)
该题和 黑书 P102 采矿 类似 参考链接:http://blog.csdn.net/shiqi_614/article/details/7819232http://blog.csdn.net/ts ...
- POJ 2482 Stars in Your Window 线段树
如果按一般的思路来想,去求窗户能框住的星星,就很难想出来. 如果换一个思路,找出每颗星星能被哪些窗户框住,这题就变得非常简单了. 不妨以每个窗户的中心代表每个窗户,那么每颗星星所对应的窗户的范围即以其 ...
- Stars in Your Window(线段树求最大矩形交)
题目连接 http://poj.org/problem?id=2482 Description Fleeting time does not blur my memory of you. Can it ...
随机推荐
- XP与Win2003下网站配置
一. 安装.net 4.0 1. 双击打开文件dotNetFx40_Full_x86_x64.exe.如图4.1 所示 (图4.1) 2. 勾选[我已阅读并结束许可条款],点击[安装]按钮.如图4.2 ...
- BlogEngine.Net
BlogEngine.Net架构与源代码分析系列part1:开篇介绍 2008-11-05 15:27 by GUO Xingwang, ...阅读, ...评论, 收藏, 编辑 最近我要开始这个系列 ...
- iOS设备隐藏StateBar
//隐藏StateBar - (BOOL)prefersStatusBarHidden { returnYES; }
- GPUImage实现过程
GPUImage就是一个函数的类库,用于对图片实现滤镜的效果. 下面是实现一个最简单的GPUImage的程序和讲解: 首先新建一个项目,导入GPUImage类库(导入过程在我的另一个博客里面有写). ...
- 深入hibernate的三种状态【转载】
这篇文章写得很好,举了很多例子. http://www.cnblogs.com/xiaoluo501395377/p/3380270.html
- Matlab编程-数值计算相关语法
1.变量的命名规则(类似C语言): (1) 区分大小写 (2) 变量长度不超过31位 (3) 变量名以字母开头,变量名中包含字母.数字.下划线,不可以用标点 2. Mathlab预定 ...
- there be 句型
there be 意思:表示存在或者发生. 英文释义:used to show that sth exists or happens 如果现在进行时,单数时用is,复数时用are. 现在我问你一个问题 ...
- Eclipse自动换行WordWrap插件
eclipse没有自动换行功能,需要安装插件wordwrap,方法请自行百度,可以参考下面的方法: http://jingyan.baidu.com/article/ce09321b7ba7042bf ...
- sql Server 发送邮件 错误类型及原因
设置警报 在[常规项]中做以下设置 新建警报 设置警报名称 选择数据库 选择严重性 在[响应项]中可以做以下设置 选择要邮件通知的操作员 可以设置执行一个警报作业 在选项 ...
- C# 获取网页数据、获取本机IP 分类: C# 2014-12-16 14:59 308人阅读 评论(0) 收藏
说明: (1) http://www.3322.org/dyndns/getip 这个网址可以获取本机IP,读取的内容就是本机IP (2)方法经测试,可以实现. (3)参考:http://www.cn ...