Problem 4023 · Medium

Elevator Requests II

The visited floors always form one interval around the start. Growing it one end at a time costs the distance moved times the requests still waiting; the cheapest growth order is kept.

Open the interactive visualisation