Hi all,
I was solving this problem: Link. It's fairly easy, so if you don't really want to solve it, I'll go ahead and write the dp recurrence here:
A pretty obvious CHT problem. But I'm getting TLE on the last test case. I don't see much difference between our codes, so I'm wondering how it could be so slow!
(P.S.: If anyone has a fairly fast implementation of CHT that would like to challenge the 436 ms, go ahead and submit it :))