Problem 3479 · Medium

Fruits Into Baskets III

Each fruit takes the leftmost basket that can hold it; a max segment tree over capacities finds that basket by descent.

Open the interactive visualisation