Problem 2382 · Hard

Maximum Segment Sum After Removals

Run the removals backwards, putting values back and merging neighbouring segments with union-find, so each answer is the best segment sum at that moment.

Open the interactive visualisation