#CT00045. Lịch ôn tập (Study Schedule)
Lịch ôn tập (Study Schedule)
Study Schedule
Version: Phuoc Hung OJ Extended
Problem Statement
During one day, the team computer room has usage proposals. Proposal occupies the room continuously from time to time and gives value if selected.
Only one proposal can use the room at a time, so selected proposals must not overlap. If one proposal ends exactly when another begins, both may be selected.
Choose a set of proposals with maximum total value.
Input
- The first line contains the positive integer .
- The next lines contain three integers .
For every : and .
Output
Print one integer: the maximum total value obtainable.
Subtasks
- Subtask 1 (30%): .
- Subtask 2 (30%): .
- Subtask 3 (40%): .
Examples
Example 1
Input
5
1 3 5
2 5 6
4 6 5
6 7 4
5 8 11
Output
17
Explanation
Choose with value and with value . They only touch at time , so they are compatible, giving total .
Example 2
Input
4
1 2 4
2 4 5
1 4 10
4 6 3
Output
13
Explanation
Choose with value and with value , for a total of .
Example 3
Input
3
1 10 7
2 3 4
3 4 4
Output
8
Explanation
Intervals and are compatible and give total , which is better than taking only with value .
Liên quan
Trong các cuộc thi sau: