Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- people = deque()
- liters = int(input())
- while True:
- command = input()
- if command == 'Start':
- break
- name = command
- people.append(name)
- while True:
- command = input()
- if command == 'End':
- break
- args = command.split()
- if len(args) > 1:
- quantity = int(args[1])
- liters += quantity
- else:
- quantity = int(args[0])
- if quantity <= liters:
- print(f'{people.popleft()} got water')
- liters -= quantity
- else:
- print(f'{people.popleft()} must wait')
- print(f'{liters} liters left')
Advertisement
Add Comment
Please, Sign In to add comment