I tried to solve this problem using Binary Index Tree and Binary Search, also I used coordinate compression, keeping the positions in which I made a delete operation. Then I do Binary Search over the function
(x - (number of deleted which are less or equal than x))
the problem is that when I've deleted a number twice the function won't be motonous, hence the Binary Search fails.
Is there other way to solve it with BIT?
there is no need to delete a number twice since number of the door to delete is given for the current moment, so if you store in your BIT only real numbers of deleted doors, there will never be a collision