Wrong Answer for half of the Test cases on hackerblocks

Code:

I am using a priority queue for allocation by which the one
who finishes first goes to next board.

I have sorted blocks in descending order.

@saswat1908 It is not the correct way to solve this. You have to preserve the order. You have to use binary search for this.