I am trying DELISH problem. This is my solution. I had already spent 3 days in understanding the editorial and then coded on my own, but it is always WA. I am unable to understand what is wrong with my code. Please someone reply what is wrong with my code. Thanks!

your answer for test:

5 4 3 2 1

is 8, but right answer is 13

1 Like

Yeah, thanks! you are right, but when i manually checked for the test case it seems that 13 should be printed and there is no way that 8 is generated in any part of my code for this test case. Do you have any idea where i may be going wrong?

My bad. I found my mistake. I typed hlax[i]=max(d[i],d[i]+hlin[i-1]); in my code instead of hlax[i]=max(d[i],d[i]+hlax[i-1]);. Take my like and answer accepted for your skills. Link to my final AC solution after 4th day of trying is http://www.codechef.com/viewsolution/2686492. Thanks for the test case!