【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 ...
随机推荐
- Win10开发必备:Visual Studio 2015正式版下载
7月21日凌晨消息,面向大众用户的Visual Studio 2015集成开发工具正式版免费试用版已经推出.本文帮大家汇总一下简体中文社区版.专业版以及企业版在线安装版以及ISO离线安装镜像下载地址. ...
- Hdu 3966-Aragorn's Story LCT,动态树
题目:http://acm.hdu.edu.cn/showproblem.php?pid=3966 Aragorn's Story Time Limit: 10000/3000 MS (Java/Ot ...
- [LeetCode] Largest Rectangle in Histogram 解题思路
Given n non-negative integers representing the histogram's bar height where the width of each bar is ...
- 数据分析:Weka,Matlab,R,SPSS,SAS等分析软件的入门
1 功能角度 weka是机器学习方面的工具(开源).spss是数学工具(商业工具). 具体的说,weka的主要功能是模式分类,或者模式识别或者回归.包括特征的降维(PCA),特征选择,训练模型以及对测 ...
- MySQL可视化管理工具 —— Navicat for MysSQL
类似PL/SQL管理Oracle的工具 Navicat可以管理MySQL 1.安装 2.连接(输入IP.端口.用户名.密码) 3.新建sql语句:点击左侧database.点击菜单“查询”.点击“新建 ...
- 趣味理解ADO.NET对象模型
为了更好地理解ADO.NET的架构模型的各个组成部分,我们可以对ADO.NET中的相关对象进行图示理解,如图所示的是ADO.NET中数据库对象的关系图. 讲究完关系图后,为了加深大家的理解,我们可以用 ...
- BJUI 转
B-JUI 前端框架B-JUI(Bootstrap for DWZ)是一个富客户端框架,基于DWZ-jUI富客户端框架修改. 本文是B-JUI中文使用手册,包括使用示例代码,感兴趣的同学参考下. 概览 ...
- OPENSHIFT MYSQL使用Navicat连接配置
最近一直在研究openshift免费空间的使用,对于如何用本地的数据库工具连接一直在找方法,呵呵,初学者. 以下方法可以实现: 1.在本地命令行中执行命令:rhc port-forward 应用名 如 ...
- JavaCodeTra 猴子选猴王 约瑟夫循环
之前用的是循环链表,java刚学,不知道怎么用链表.用个小算法吧 代码: import java.util.Scanner; /** * */ /** * @author john * @约瑟夫循环/ ...
- c++拷贝构造函数(深拷贝,浅拷贝)详解
一.什么是拷贝构造函数 首先对于普通类型的对象来说,它们之间的复制是很简单的,例如: ; int b=a; 而类对象与普通对象不同,类对象内部结构一般较为复杂,存在各种成员变量. 下面 ...