You are a project manager with 'N' projects available to undertake. Each project is defined by its duration, a deadline, and the reward you receive for completing it on or before its deadline.
You also have a team of 'K' expert helpers. You can assign a helper to any project to reduce its duration to half of the original, rounded down.
The rules of engagement are as follows:
1)You start at time 0.
2)Projects are done sequentially, one at a time, with no breaks in between.
3)The finish time of a project is start_time + duration. This finish time must be less than or equal to the project's deadline to earn the reward.
4)Each of the 'K' helpers can be used at most once across all projects.
5)A single project can have at most one helper assigned to it.
Your goal is to select a subset of projects, decide the order in which to perform them, and strategically assign your 'K' helpers to the chosen projects to maximize your total earned reward.
Input Format:
The first line of input contains two space-separated integers, 'N' and 'K'.
The next 'N' lines each contain three space-separated integers: duration, deadline, and reward for a single project.
Output Format:
Print a single integer representing the maximum total reward you can achieve.
Note:
A key insight for scheduling problems is to consider processing jobs in order of their deadlines. This greedy choice often simplifies the problem.
When a helper is used on a project with duration d, the new duration becomes floor(d / 2).
This problem can be solved using dynamic programming. A state could be defined by the projects considered, the time elapsed, and the number of helpers used.