Why Does My Bottom-Up DP Solution Fail?

Revision en1, by coco_elon, 2016-09-24 01:59:19

I found this question in Codeforces Round #373 (Div. 2).

http://codeforces.me/problemset/problem/719/B

My solution:

https://ideone.com/RYOQkS

Can someone please help me find why my solution fails and how to correct it accordingly?

Thanks in advance!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English coco_elon 2016-09-24 01:59:19 304 Initial revision (published)