After 5 attempts, got this problem working. One key problem was in the problem statement: The arrival times for each test case are strictly increasing.
Turns out that it should actually be: The arrival times for each test case are strictly non-decreasing.
Feels good to have solved this problem.