WA in SUMTRAIN

I have tried the SUMTRAIN problem, as suggested in the comments below the problem, i have to add the largest integer per row irrespective or their position . so tried this : https://ideone.com/gsz60r

But it give Wrong Answers. Any suggestion what will be causing WA in this?

check this link http://discuss.codechef.com/questions/42976/sumtrian-prerequisite

your approach will give wrong answer because we cant move from top to bottom directly jumping to the largest integer row by row.


* we need to follow the given rules.
* the member at position (i,j) can move to (i+1,j) or (i+1,j+1)
* we can use recursion with memoization here to solve with in time limit.
* try this method… my soln. is http://ideone.com/zXuDch

The logic explained there, doesnot work even on the sample test cases.
I tried some of the accepted programs and they DONOT follow that logic at all.

i have done the problem reading that answer only
you can check my solution…
http://www.codechef.com/viewsolution/3916102