Problems > Spread the Routers > Editorial

Spread the Routers — Solution & Editorial

Back to the Problem

Binary search the answer d: greedily place a router at the first position and then at each next position ≥ d away; feasible iff C fit. Maximize the feasible d.

Complexity: O(N log N + N log max)