Here is the [problem](http://www.spoj.com/problems/ORDERSET/)↵
↵
Here is my [solution](https://pastebin.com/JQRwjSRX)↵
↵
I tried to solve it using treaps.↵
↵
I keep on getting WA. In another attempt I tried to store values in map for checking duplicates(i won't insert when duplicates) but I got TLE. Can anyone help me in finding out the bug. Thanks.
↵
Here is my [solution](https://pastebin.com/JQRwjSRX)↵
↵
I tried to solve it using treaps.↵
↵
I keep on getting WA. In another attempt I tried to store values in map for checking duplicates(i won't insert when duplicates) but I got TLE. Can anyone help me in finding out the bug. Thanks.