There are a lot of bugs in the TooManyBugs project. Each bug is described by two values: priority and fixTime.
There are only a few days left before the deadline. Each day has a corresponding workTime, and a bug can be fixed on that day if the bug's fixTime is less than or equal to workTime. No more than one bug can be fixed in a single day, and no bug fix can span more than a single day.
You are given a String[] info, each element of which describes either a single bug or a single day. Each element can be in one of the following two formats:
- "PRIORITY FIX_TIME", which means that there is a bug with
priority equal to PRIORITY and fixTime equal to FIX_TIME;
- "WORK_TIME", which means that there is a day with workTime equal to WORK_TIME.
Determine a strategy that maximizes the sum of the priorities of the bugs you fix, and return this sum.
|