Untitled

mail@pastecode.io avatar
unknown
python
a month ago
427 B
1
Indexable
Never
def process_queue(arrival_times):
  processing_times = []
  queue = []
  current_time = 0
  
  for t in arrival_times:
    if len(queue) <= 10:
      queue.append(t)
      
    if len(queue) == 0 or queue[0] <= current_time:
      current_time = max(t, current_time + 300)
      processing_times.append(current_time)
      queue.pop(0)
    else:
      processing_times.append(t)
      
  return processing_times
Leave a Comment