Note: This is an approximate problem. There is no exact solution. You must find the most optimal solution. Please, take a look at the sample explanation to ensure that you understand the problem correctly.
Given a CPU which can work for W minutes and can handle one process at a time.
N process are given with their benefit value B[i], run time R[i] (in minutes) and deadline D[i] (in minutes). All process are available from time T=0.
Find a subset of N processes and their order for execution, with maximum possible sum of benefit value. They should be handled by CPU without collision and satisfying their deadlines.
The goal is to maximize Z=∑B[j].
Note:
Input
Output
Constraints
1≤N≤1051≤W,D[i]≤1091≤R[i],B[i]≤106
50% of the test files have N=105.
50% of the test files have N≤103
Verdict and scoring
Your score is equal to the sum of the values of all test files. The value of each test file is equal to the value of Z that you found.
If the output format if wrong or X selected process does not meet their deadlines or total runtime exceeds W or collide Wrong Answer verdict will be recieved.