Job completion times

Write codeHard30 min

Your task

A render farm has one machine, and jobs may be paused and resumed at whole minutes at no cost. Job i arrives at minute arrives[i], needs work[i] minutes of the machine, and is due at minute due[i]. The machine always runs the arrived, unfinished job with the earliest due minute, and a tie goes to the lower job index. It switches the moment a job with an earlier due minute arrives, and it idles when nothing has arrived. Return the minute at which each job finishes, in input order: a job that starts at minute 0 and gets three uninterrupted minutes finishes at minute 3. Jobs are listed in any order, work is at least 1, and several jobs may arrive in the same minute.

Examples

render_finish_minutes(arrives: list[int], work: list[int], due: list[int]) -> list[int]
Example 1
Inputrender_finish_minutes([0, 0], [3, 2], [10, 5])
Output[5, 2]
Example 2
Inputrender_finish_minutes([0, 4], [5, 2], [10, 6])
Output[7, 6]
Example 3
Inputrender_finish_minutes([0, 10], [2, 3], [5, 9])
Output[2, 13]