Topcoder ABC

I was trying to solve Topcoder SRM Div 2 Hard -ABC but have no clue on how to proceed.

I tried searching for the editorial on Topcoder but they are wrongly linked to other SRM.

On Codeforces, the problems were discussed but they were too brief for me to understand.

It seems to be a dp question.
Can anyone help me by giving some hint on the dp state and transitions?
Also if there is another approach, do share.

1 Like