ZCO 2014 IPL problem WA

I am participating in zco 2015 and wanted to solve previously asked problems and got stuck on this problem. the problem is my code works for the first three inputs but fails on the remaining. My logic is as follows:
if the guy has played jth game and not (j-1)th game, he chooses the max from j+1 or j+2(skipping j+1 game).
else he chooses j+2th game and continues.
can anybody tell me what might be wrong in this!?
this is the link to problem statement:
http://www.iarcs.org.in/inoi/2014/zco2014/zco2014-2b.php

Okay here’s the solution:
http://discuss.codechef.com/questions/57151/zco-dynamic-programming-problems

http://discuss.codechef.com/questions/55874/iplzco-2014/55885