I am WA
question link:-http://www.codechef.com/problems/BEX/
my solution:-http://www.codechef.com/viewsolution/6834616
My solution is differnt from the editorial and in the editorial they have used a good method of not adding books having greatyer reamaining exercises.
Howerver I have used 2 stacks.one store the wors and the other store min upto top.
but i am getting wrong ans.plzz correct me