How to solve ORDERSET problem on spoj?

binary-search
segment-tree

#1

Link: http://www.spoj.com/problems/ORDERSET/


#2

this link might be of some help !!

http://codeforces.com/blog/entry/6700