cswork / OA打开练习工作台

WeworkOA #2

Shopping and Billing

估计中等评测数据准备中,可先阅读题面

考点(AI 标注)模拟/实现单调栈与堆

In a shop with N counters, M people arrive for billing at different times denoted as time[i]. Each person selects the counter with the shortest queue, based on the number of people already present. If a counter is empty, the person gets immediate billing, otherwise, they join the queue. For every person, output the time when they finish billing and leave the counter. Notes

  • It takes 1 unit of time for the counter to process a person's bill.
  • The counter processes the next person immediately after the current person leaves. Input/Output
  • The first line contains N denoting the number of counters.
  • The second line contains M denoting the number of persons.
  • The third line contains an array time, indicating the entry time of the people.