【杂】poj2482 Stars in Your Windows 题面的翻译
原地址:http://poj.org/problem?id=2482
神题,被誉为最浪漫的题目,一位acmer以自己独特的方式写下的殷殷情语,感觉写的太好了,于是翻译了一下,翻译完感觉整个英语水平都提高了
你窗前的星星
纵时光飞逝如梭,也我对你的回忆也永不黯然。从第一次见面以来,也许已经有四年之久了。但是,我记得,我清晰地记得,四年前的那一天,那一幕,那一抹阳光,那一弯微笑,它们如同刻刀一般,在我心中留下了如此清晰的印记。
四年前,在美丽的珠海校园,在无意间,我瞥见了你的含笑的背影。命运牵引着我的视线向你而去。你轻轻地跨过班级的大门,当你纤细的手抚过门框的那一刻,你回过了头。一束柔软的阳光毫无拘束地流淌在你玫瑰色的脸颊上。我怔住了,我知道,我清楚地知道,我已经为美丽的你而陶醉。几个月,我不断地观察着,打听着,刺探着,我发现了更多的你。优雅慈悲的你,智慧聪颖的你;积极乐观的你,心怀梦想的你,都在我的内心深处安了家。你希望着,能与你这样的魅力阳光女孩白头偕老。唉,实际上,你离我疯狂的梦想很远,而我也不知如何在隔开你我的海湾上架桥。我什么都没有做,只是等待,等待机遇之神的福祉,直到现在。毕业的钟声已然敲响,我这才从梦境中幡然悔悟,我居然是这样一个蠢货!明明能创造机会并抓住它,我却选择了徒劳的等待!
剩下的日子,掰着手指头都能数的清了。老朋友,舍友,同班同学,一个接着一个与我惜别。放下挥动的手,茫然的我却接受不了残酷的真相。这些每天都能见到的熟悉面庞,就这样从我的人生之中消失,然后除了记忆之外,便什么也不剩了。几天后,我也得离开熟悉的校园。我看见,你正计划着飞过重洋,捕捉未来履行梦想。我突然明白,如果没有机缘,我可能再也见不到你的脸了!那一夜,我在你的宿舍外彷徨着,想借机再见你一面。我很矛盾,如果你一出现,我的心跳变得飞快,我笨拙的舌头一个字也吐不出来怎么办?我匆匆地避过别人的目光,经过你的宿舍楼下,用余光撇着你的窗台,到了路口,又忍不住折回来,不记得这个过程重复了多少次。每一次经过,我都强烈盼望着,能看见你突然出现在阳台上,抑或是看见你的轮廓映在窗前!我也不记得,多少次徒生了这样的想法:大声喊出她的名字,请她一起来共享晚餐,或者至少是说个话?想到你的完美与我的平凡,我的勇气最终败给了胆怯。又一次到了路口,我默默离开了,再也没有回过头。
毕业,意味着大学时光之结束,这充满荣誉与浪漫时代的终结。我清晰地记得,你可爱的微笑是我拼搏的最初动力,这种充满遗憾的爱意,永远地被封存在我的记忆之匣里。毕业,也意味着一段新的征程,人生之途上,清晰的脚印指向着明亮的未来。我无比衷心希望,你在国外的时光能充满幸福与美满!当然了,我也会试着摆脱那些幼稚的想法,变得更加成熟。但是,这种追求真爱,追求真正幸福的希冀,我永远都不会让它随岁月干枯!
再见了!我亲爱的公主!
如果有那么一天,在某个地方,我们有缘再见面。也许我们已经成了两鬓斑白的老妪和老翁。我希望我们在那个时候,能成为好朋友,高高兴兴地分享这段美丽的记忆,那时候,青春的火焰又会被重新点燃,每一个人再次被浸入那愉悦的气氛里。假如我得不到这样的机会,我情愿做一颗明亮星星,在你的窗前闪烁,在遥远的地方祝福着你。我会以一个好朋友的身份,和你共度每一个夜晚,与你分享甜蜜的美梦,陪你穿过无尽的恶魇。
那么问题来了,假定天空是一个平面,每个星星都有一个坐标(x,y),每颗星星都有一个等级从1到100不等,代表它的亮度,其中100是最亮的,1是最弱的。窗户是长方形的,有固定的长和宽,边平行于x轴和y轴。你的任务是告诉我如何摆放窗户,才能获得在窗口内所有星星的亮度总和最大值。注意,边框的星星不算。窗口可以被平移,但不允许旋转。
输入
在输入中有几个测试用例。每一行的第一行包含3个整数:n,w,h,表示星形的数目,矩形窗口的水平长度和垂直高度。然后N行如下,有3个整数分别为:X,Y,C,表示星星位置(x,y)和每个恒星的亮度。没有两颗星星在同一点上。
天空中至少有1颗,最多有10000颗星星。1 = W,h = 1000000,0 x x,y < 2^31。
输出
对于每个测试用例,在一行中输出最大亮度。
样例输入
3 5 4
1 2 3
2 3 2
6 3 1
3 5 4
1 2 3
2 3 2
5 3 1
样例输出
5
6
来源
poj大赛,作者:kinfkong @ZSU,翻译:nitrate
未经允许不可转载
先码一下,还没A掉这题,总之是线段树+扫描线。但这题的重点根本不是线段树好么?!!!
附英文原题
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.
![](http://poj.org/images/2482_1.jpg)
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
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