Problem 2681 · Hard

Power of Heroes

Sort the strengths, then carry a running weighted sum so each hero is the strongest in its group exactly once.

Open the interactive visualisation