"POJ2482" "segment Tree" Stars in Your Window

Source: Internet
Author: User

Description

Fleeting time does not blur my memory for you. Can It really is 4 years since I first saw you? I still remember, vividly, on the beautiful Zhuhai Campus, 4 years ago, from the moment I saw you smile, as you were Walki Ng out of the classroom and turned your head back, with the soft sunset glow shining on your rosy cheek, I knew, I knew th At I is already drunk on you. Then, after several months ' observation and prying, your grace and your wisdom, your attitude to life and your aspiration For the were all strongly impressed on my memory. You were the glamorous and sunny girl whom I always dream of share the rest of my life with. Alas, actually you were far beyond my wildest dreams and I had no idea on how to bridge that gulf between you and me. So I schemed and to-wait, to-wait for an appropriate opportunity. Till now-the arrival of graduation, I realize I am such an idiot that one should create the opportunity and seize it ins Tead of just waiting.

These days, has parted with friends, roommates and classmates one after another, I still cannot believe the fact that a Fter waving hands, these familiar faces would soon vanish from our life and become no more than a memory. I'll move out from school tomorrow. And you is planning to fly far far from away, to pursue your the future and fulfill your dreams. Perhaps we'll not meet each of the more if without fate and luck. So tonight, I is 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 is not able to belch out a word. I cannot remember how many times I had passed your dormitory building both in Zhuhai and Guangzhou, and each time aspire D to see you appear in the balcony or your silhouette this cast on the window. I cannot remember how many times this idea comes to my mind:call she out to has 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 would 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 "the" to bright prospect. I truly hope you'll be happy everyday abroad and everything goes well. Meanwhile, I'll try to get out from puerility and become more sophisticated. To pursue my own love and happiness here in reality would be my ideal I never desert.

Farewell, my princess!

If Someday, somewhere, we have a chance to gather, even as gray-haired mans and woman, at the 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 Fri Ends, 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 in it with a location (x, y). For each star, there are a grade ranging from 1 to 1, representing its brightness, where are the brightest and is th E weakest. The window is a rectangle whose edges was 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 is right on the edge of the Windows does not count. The window can be translated but rotation are not allowed.

Input

There is several test cases in the input. The first line of all case contains 3 integers:n, W, H, indicating the number of stars, the horizontal length and the VE rtical 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. The stars is on the same point.

There is at least 1 and at most 10000 stars in the sky. 1<=w,h<=1000000, 0<=x,y<2^31.

Output

For each test case, the output of the maximum brightness in a single line.

Sample Input

3 5 41 2 32 3 26 3 13 5 41 2 32 3 25 3 1

Sample Output

56

Source

POJ Contest,author:[email protected] "analysis" nothing to say. Convert the point into a matrix that can be overwritten, then scan the line ...
1 /* 2 Tang du Fu 3 "former Zhaojun nine first · Its six" 4 bows drawn when strong, use arrows as long. A man shoots a horse, and the thief first tackles the king.  5 The killing is also limited, the nations have their own Xinjiang. Gou can make the invasion of the tomb, how many kill.  6* /
View Code

"POJ2482" "segment Tree" Stars in Your Window

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.