len(speeds) stations, and each of len(sizes) orders passes through all of them in turn, strictly in the order of the array sizes. Station i spends exactly speeds[i] · sizes[j] time units on order j.
An order can never wait between stations: as soon as a station finishes, it hands the order to the next station, which must be free at that moment. A station handles only one order at a time. The first order starts at time 0.
Return the earliest time at which the last station finishes the last order.speeds=[2, 1], sizes=[3, 1] → 10
Order 0: station 0 works from 0 to 6, station 1 from 6 to 9. Order 1 starts at 7: station 0 works from 7 to 9 and hands it over exactly when station 1 frees up, which finishes at 10.
speeds=[3], sizes=[2, 5] → 21
With one station it is just 3·2 + 3·5 = 21.
speeds=[1, 4, 2], sizes=[2, 3, 1] → 30
speeds=[2, 1], sizes=[3, 1]
10
Run checks the first 3 tests in your browser. Submit checks all 104 tests on the server, hidden ones included.