Capital OneOA #16
Queue Check-in Simulation with Capacity Limit
估计中等可在线判题
考点(AI 标注)模拟/实现单调栈与堆
A single service desk serves people first come, first served, and each person takes 30 seconds. On arrival, if the number of people currently in the system is greater than 10, the person leaves immediately; otherwise they are admitted and their service start time is output. Output null for anyone not admitted.
输入格式
The first line contains n (this site adopts the source's suggested range 1≤n≤200000), and the second line contains n non-decreasing arrival times arrival[i] (this site adopts the source's suggested range 0≤arrival[i]≤10^9). People arriving at the same time join the queue in input order.
输出格式
Output each person's service start time or null in input order, separated by spaces. The rules in the statement imply that the system admits at most 11 people; at the exact moment someone finishes, the finished person leaves first.
样例 1
输入:
3
0 0 0
输出:
0 30 60
样例 2
输入:
3
0 10 20
输出:
0 30 60
样例 3
输入:
2
0 100
输出:
0 100