Help me understand minimize the sum problem of october long challenge

I am unable to solve the mindsum problem .
Can someone explain me.

Check the editorial here

//