PROBLEM LINKS:
DIFFICULTY:
Easy
PREREQUISITES:
Priority Queue, Queue
SOLUTION:`
Official Solution : http://www.ioi2009.org/GetResource?id=1965
Explanation - We simulate the problem using a queue. For finding out the minimum position we maintain a priority queue of all the available positions.
EDITORIALIST’S SOLUTION:
Can be found here.