DP in LEBALONS, help needed, anyone?

I cross checked it with the tester’s solution on some test cases.

Can somebody tell me why is it a WA.

What is wrong in the DP for this question.

I have posted this question for quite a long time, no responses till now.

Your help would be deeply appreciated. Thank You.

http://www.codechef.com/viewsolution/3973475