help needed in a dp problem.

https://codejam.withgoogle.com/2018/challenges/0000000000007706/analysis/0000000000045875

I have read the editorial but couldn’t understood the second part. can someone please elaborate that part. Thanks in advance !