I used DSU algorithm and AC 0.046.

test:

10

4 5 3 6 9 10 8 7 2 1

answer: Not a proof.

Thanks for the test case... Helped a lot to find bug in my algo.

I am wondering how to use DSU here...

Would you please mail me your idea?

ealham86@gmail.com

Thanks again.