LearnPy Hub
← Arena
AdvancedRating 1800

Most Profitable Jobs

Each job has a start time, an end time and a profit. You can't do two jobs that overlap (a job may start exactly when another ends). Print the largest total profit.

Input

n; then n lines 'start end profit'.

Output

One integer.

Sample 1

Input
4
1 3 50
2 4 10
3 5 40
3 6 70
Output
120

Sample 2

Input
5
1 3 20
2 5 20
3 10 100
4 6 70
6 9 60
Output
150
solution.py
Output appears here
Most Profitable Jobs · Python Arena problem · LearnPy Hub