Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- products = deque()
- robots_list = []
- robots_data = input().split(";")
- hours, minutes, seconds = [int(s) for s in input().split(":")]
- start_time_seconds = hours * 3600 + minutes * 60 + seconds
- for robot in robots_data:
- robot_name, process_time = robot.split("-")
- busy_until_time = 0
- robots_list.append({'name': robot_name, 'data': [int(process_time), busy_until_time]})
- while True:
- product = input()
- if product == "End":
- break
- products.append(product)
- while products:
- current_product = products.popleft()
- is_taken = False
- start_time_seconds += 1
- for robot in robots_list:
- if robot['data'][1] <= start_time_seconds:
- robot['data'][1] = start_time_seconds + robot['data'][0]
- h = start_time_seconds // 3600
- m = (start_time_seconds % 3600) // 60
- s = (start_time_seconds % 3600) % 60
- h %= 24
- print(f"{robot['name']} - {current_product} [{h:02d}:{m:02d}:{s:02d}]")
- is_taken = True
- break
- if not is_taken:
- products.append(current_product)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement