Task DescriptionDiscussion (0)
Task :: z-menadzer
Mr. Little Z has decided to find a job as a manager. After a few days of looking for a job, he has finally found a job at the famous company Zoogle. At his first day of work he got a serious assignment:
The head manager of the company loves to watch movies. However, he doesn't have enough free time. Mr. Little Z's assignment is to record movies for the head manager. The head manager has given Mr. Little Z a list of movies and for each movie: when it starts, when it ends, and how much money Mr. Little Z will get if he records the movie.
Mr. Little Z has only one recorder and he wants to record the movies so that he can earn as much money as possible.
INPUT:
The first line of the standard input contains a natural number N (1<=N<=100000) representing the number of movies on the list. In the next N lines you are given three natural numbers. P, K and O, where 1<=P < K <= 2000000000, and 1<=O<=1000. P represents the time when the movie starts, k represents the time when the movie ends, and O represents Mr. Little Z's earnings for the movie if it is recorded.
The first line of the standard input contains a natural number N (1<=N<=100000) representing the number of movies on the list. In the next N lines you are given three natural numbers. P, K and O, where 1<=P < K <= 2000000000, and 1<=O<=1000. P represents the time when the movie starts, k represents the time when the movie ends, and O represents Mr. Little Z's earnings for the movie if it is recorded.
OUTPUT:
To the standard output write only one number corresponding to Mr. Little Z's maximum earnings.
To the standard output write only one number corresponding to Mr. Little Z's maximum earnings.
Input:
Output:
Additional example:
Input:
Output:
3
1 5 2
2 6 3
6 8 2
1 5 2
2 6 3
6 8 2
Output:
4
Additional example:
Input:
4
1 3 2
4 6 2
2 5 8
4 5 3
1 3 2
4 6 2
2 5 8
4 5 3
Output:
8
Submit Solution
Available Languages
Task info
| Name: | z-menadzer |
| Time: | 1.5 sec. |
| Memory: | 16 MB |
| #Tests: | 20 |
| Author: | Eric D.Demaine i Charles E. Leiserson |
| AddedBy: | admin |
Task Ratings
| Difficulty: | 4.4 (21 votes) |
| Quality: | 4.2 (19 votes) |
Acceptance Rate
Recent Submissions
Fastest Solutions
| User | Time |
|---|---|
| bl4ck.c0d3r | 0.885 s. |
| A.Armin | 0.885 s. |
| hadzem | 1.26 s. |
| msantl | 1.935 s. |
| leandro | 1.965 s. |
| Martin | 2.04 s. |
| carlosjoa | 2.05 s. |
| nullzero | 2.07 s. |
| Al3kSaNdaR | 2.085 s. |
| mushclass | 2.13 s. |
Solved By
Home
Training
Competitions
Forum
FAQ