Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!usr/local/bin/python3.8
- # -*- coding: utf-8 -*import
- from collections import deque
- robots_info = input().split(';')
- start_time = list(map(int, input().split(':')))
- time = sum([start_time[0]*60*60, start_time[1]*60, start_time[2]])
- robots = {}
- products = deque()
- def get_time(t: int):
- seconds = t % 60
- hours = (t // 60) // 60
- minutes = (t // 60) - hours * 60
- seconds_print = f'0{seconds}'if seconds < 10 else seconds
- minutes_print = f'0{minutes}' if minutes < 10 else minutes
- hours_print = f'0{hours}' if hours < 10 else hours
- return f'{hours_print}:{minutes_print}:{seconds_print}'
- while True:
- command = input()
- if command == 'End':
- break
- product = command
- products.append(product)
- for x in robots_info:
- key, value = x.split('-')
- robots.update({key: [int(value), time]})
- second = 1
- for x in robots:
- robots[x][1] += second
- second += 1
- print(f'{x} - {products.popleft()} [{get_time(robots[x][1])}]')
- if not products:
- break
- robots[x][1] += robots[x][0]
- while True:
- if not products:
- break
- fastest = min([robots[x][1] for x in robots])
- rotation = [robots[x][0] for x in robots if robots[x][1] == fastest][0]
- products.rotate(-(rotation - 1))
- for x in robots:
- if robots[x][1] == fastest:
- print(f'{x} - {products.popleft()} [{get_time(robots[x][1])}]')
- robots[x][1] += robots[x][0]
- if not products:
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement