Another Longest Increasing Subsequence Problem

SPOJ - LIS2