I got wrong answer in this.
My sol:http://www.codechef.com/viewsolution/3292357
I couldn’t find any test cases where it fails.Can anyone give me any test case for it
1 Like
@kevind The last solution you submitted failed for:
1
3 0 0
1
1 2 3
the answer is :
3
1
Though your earlier solutions mostly gave runtime errors , this was because you were using a recursive DP implementation which could go to a depth of about 10^6, this would surely exceed stack size.
My code gives correct output for above cases
1 Like
@kevind It seems there was an extra ‘\n’ in the end of the input file which gave rise to WA verdict, while when you had used while(scanf("%d",&n)!=EOF) you gave correct answer for above test case but went on to another test case with N==10^6 where RTE was encountered.