Help needed in Atcoder ABC-113 D

Revision en1, by nilesh8757, 2018-12-01 18:28:50

I was trying to solve this problem form recent Atcoder's beginner contest , but after scratching my head for almost 2h I could not come up with the solution.Then I tried to look for the editorials but this time they were not in English. square1001 has provided solution there which I find uses some kind of DP. Can anyone who has solved this problem explain DP recurrence behind this ?


  Rev. Lang. By When Δ Comment
en1 English nilesh8757 2018-12-01 18:28:50 487 Initial revision (published)