Minimum delivery factor

Write codeHard42 min

Your task

A render farm runs one batch a night on a single machine and never idles between jobs. Job i was submitted at minute submitted_at[i] and needs render_minutes[i] of machine time, always at least one minute. The batch begins at minute start_at, by which point every job is queued. The contract promises each customer delivery by their own submission minute plus factor times their own render minutes, so a heavy job is allowed proportionally more room than a light one. The farm may run the batch in whatever order it likes. Return the smallest whole factor for which some order delivers every job on time, and 0 for an empty batch. Note that the promised times, and therefore the order they suggest, move as the factor moves.

Examples

smallest_slowdown_factor(submitted_at: list[int], render_minutes: list[int], start_at: int) -> int
Example 1
Inputsmallest_slowdown_factor([0, 30, 40], [20, 3, 2], 40)
Output5
Example 2
Inputsmallest_slowdown_factor([0, 0], [5, 5], 0)
Output2
Example 3
Inputsmallest_slowdown_factor([0, 10, 20], [6, 6, 6], 20)
Output5