Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- list_of_the_customers = list(int(c) for c in input().split(", "))
- list_of_your_taxis = deque(int(t) for t in input().split(", "))
- total_time_to_drive = 0
- while list_of_the_customers and list_of_your_taxis:
- current_customer = list_of_the_customers[0]
- current_taxi = list_of_your_taxis[-1]
- if current_taxi >= current_customer:
- total_time_to_drive += current_customer
- list_of_your_taxis.popleft()
- list_of_the_customers.pop()
- elif current_customer > current_taxi:
- list_of_the_customers.append(current_customer)
- list_of_your_taxis.popleft()
- if len(list_of_the_customers) == 0:
- print(f"All customers were driven to their destinations")
- print(f"Total time: {total_time_to_drive} minutes")
- else:
- left_customers = len(list_of_the_customers)
- print(f"Not all customers were driven to their destinations")
- print(f"Customers left: {(', '.join(str(left_customers)))}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement