http://www.codechef.com/viewsolution/3411405
tried many test cases but on submitting i get wa
problem link: SMHTD Problem - CodeChef
thanks in advance!!
http://www.codechef.com/viewsolution/3411405
tried many test cases but on submitting i get wa
problem link: SMHTD Problem - CodeChef
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.