Hello,
I have noticed that the problem statement of C5 Problem - CodeChef is incorrect. It asks to output only the length of the longest increasing subsequence. After not getting AC, I checked out the solutions of others, and it turned out, that the subsequence itself should be printed on the second line. I just wanted to let you know.
Good luck!