You are given a list of tasks, each having a deadline and associated profit if completed within the deadline. Each task takes 1 unit of time to complete. What is the maximum profit you can make?
Tasks (deadline, profit): [(4, 20), (2, 10), (2, 40), (1, 30)]
Output: 90
Explanation: Order of Tasks: 4, 3, 1
The first line contains an integer ‘T’ denoting the number of test cases.
For each test case, the input contains the following lines:
One line for each test case, with the maximum profit that can be made.
2
4
4 20
2 10
2 40
1 30
6
2 20
2 40
2 30
1 10
3 50
3 60
90
150
1 <= t <= 10
1 <= n <= 2000
1 <= deadlinei, profiti <= 1000