please help getting wa smhtd

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

tried many test cases but on submitting i get wa

problem link: http://www.codechef.com/problems/SMHTD

thanks in advance!!

Its not the way you are getting it. It is based on Longest Increasing Subsequence problem.

Read this to know the approach.

//