Problem 3727 · Medium

Maximum Alternating Sum of Squares

Give the largest squares to the plus positions: there are ceil(n/2) of them, so sort the squares and split.

Open the interactive visualisation