C5: WA on codechef but AC on Uva oj

c-plus-plus
dynamic-programming
wa

#1

My code here is working perfectly fine on Uva Oj but after modifying a little bit, it’s giving WA on codechef
http://ideone.com/7iwGJg


#2

i have used O(n) backtracking instead of the O(n^2) backtracking used in the solutions, for printing the LICS