Can someone provide some hint for solving this prbolem of spoj www.spoj.com/problems/LIS2/. The approach I am trying is very similar to the LIS dp solution(O(Nlogn)).
Although it runs till test case 9, but then gives TLE on test case #1 on spoj. Here is the code: http://ideone.com/B1xLo6
What else should I use to optimize it?