Deterministic task scheduler
Your task
Simulate a deterministic single-threaded timer event loop. You are given tasks as [scheduled_time, duration, id]. The loop processes tasks in order of scheduled_time; ties are broken by lower id. The CPU runs one task at a time to completion (no preemption). A task cannot start before its scheduled_time; if the CPU is busy past that time, it starts when the CPU frees, and if the CPU is idle before scheduled_time, the loop waits. Return a list of [id, start_time, end_time] in execution order.
Examples
event_loop(tasks: list[list[int]]) -> list[list[int]]Example 1
Input
event_loop([[0, 5, 1], [2, 3, 2]])Output
[[1, 0, 5], [2, 5, 8]]