I have been trying BOOKLIST http://opc.iarcs.org.in/index.php/problems/BOOKLIST question for a while but i am only able to fetch 60 points. I am using vectors to insert and erase elements. But because of complexity of erase,O(N), I am getting TLE. Can someone point me in the right direction. Is their some standard algorithm to solve these types of questions??
Here is my code: http://ideone.com/DVv5CN