0, 1, …, n are linked by two parallel tracks, a slow one and a fast one. The leg from station i to station i + 1 costs slow[i] on the slow track and fast[i] on the fast track (arrays are 0-indexed).
You start at station 0 on the slow track. At any station you may switch from the slow track to the fast one for switch_fee (paid every time you do it), and switch back from fast to slow for free. Staying on the same track costs nothing beyond the legs themselves.
Return an array of length n whose i-th element is the minimum cost of reaching station i + 1 on either track.slow=[4, 9, 9, 2], fast=[6, 1, 1, 8], switch_fee=5 → [4, 10, 11, 13]
Station 1 is cheapest on the slow track (4). For stations 2 and 3 it pays to switch to the fast track at station 1: 4 + 5 + 1 = 10, then 10 + 1 = 11. For station 4, drop back to the slow track for free: 11 + 2 = 13.
slow=[10, 10], fast=[2, 3], switch_fee=4 → [6, 9]
Switch to the fast track right away: 4 + 2 = 6, then 6 + 3 = 9.
slow=[1, 1, 1], fast=[1, 1, 1], switch_fee=3 → [1, 2, 3]
slow=[4, 9, 9, 2], fast=[6, 1, 1, 8], switch_fee=5
[4, 10, 11, 13]
Run checks the first 3 tests in your browser. Submit checks all 98 tests on the server, hidden ones included.