Problem 1478 · Hard

Allocate Mailboxes

Each mailbox serves a contiguous run of houses at their median, and a layered DP chooses where the runs split.

Open the interactive visualisation