Can someone please give me some hints to solve this problem. Thanks in Advance!!
If you have time, also tell us why you chose the problems you chose.
This problem is from ACM Southwestern European Regional Contest, Paris 2003
Need idea: Tried to solve it using bitmask + segment tree, but getting WA. Any idea about how to solve this problem efficiently?