【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 ...
随机推荐
- Light OJ 1051 - Good or Bad
题目大意: 给你一个字符串,字符串由大写字母和‘?’组成,大写字母可以变成任意一个字母.现在我们定义字符串, 如果有超过三个连续的元音字母或者连续五个辅音字母,那么我们称这个字符串是“BAD”,否则称 ...
- 【转】VC的MFC中重绘函数的使用总结(整理)
原文网址:http://www.cnblogs.com/x8023z/archive/2008/12/09/mfc33.html 在刷新窗口时经常要调用重绘函数MFC提供了三个函数用于窗口重绘Inva ...
- 任意轴算法 ( Arbitrary Axis Algorithm )
已知三维空间中任意单位向量,求以该向量为Z轴的local正交坐标系: 如上图,每个模型都有自己local 坐标系,已知其中一个朝向求另外两个方向. 在autodesk中采用的是Arbitrary Ax ...
- Supervisord管理
原文地址:http://blog.csdn.net/fyh2003/article/details/6837970 学习笔记 Supervisord可以通过sudo easy_install supe ...
- poj 1106 Transmitters (枚举+叉积运用)
题目链接:http://poj.org/problem?id=1106 算法思路:由于圆心和半径都确定,又是180度,这里枚举过一点的直径,求出这个直径的一个在圆上的端点,就可以用叉积的大于,等于,小 ...
- hdu 4403 枚举
#include<cstdio> #include<cstring> #include<iostream> #include<cmath> #inclu ...
- 用js判断一个复选框是否被选中
<html> <head> <title> 复选框全选.全不选.反选.必选一个 </title> ...
- .htaccess文件的妙用
.htaccess是Apache HTTP Server系统级别的配置文件,通常用来实现主机本身以外的一些功能的,比如说重定向.Gzip.以及访问限制等等………… 1.重定向(301跳转) 相信这个功 ...
- XSS 简单理解
什么是XSS? XSS(Cross Site Scripting),即跨站脚本攻击,是一种常见于web application中的计算机安全漏洞.XSS通过在用户端注入恶意的可运行脚本,若服务器端对用 ...
- js实现table中前端搜索(模糊查询)
项目中用到js前端搜索功能,根据 姓名或姓名 进行 搜索,实现方法如下,遍历table所有行中的某列,符合条件则置tr为display:'',不满足条件置tr为display:none. 代码如下: ...