Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- number_of_tourists = int(input())
- places = input().split()
- places = [int(i) for i in places]
- full_wagon = []
- not_lifted_tourists = False
- all_good = False
- free_spots_sum = 0
- for k in places:
- empty_spot = 4 - k
- free_spots_sum += empty_spot
- if free_spots_sum < number_of_tourists:
- not_lifted_tourists = True
- elif free_spots_sum == number_of_tourists:
- all_good = True
- for j in places:
- free_spots = 4 - j
- if number_of_tourists >= free_spots:
- number_of_tourists -= free_spots
- full_wagon += str(j + free_spots)
- elif number_of_tourists < free_spots:
- full_wagon += str(j + number_of_tourists)
- number_of_tourists -= number_of_tourists
- elif number_of_tourists == 0:
- pass
- if all_good:
- print(" ".join(full_wagon))
- elif not_lifted_tourists:
- print(f"There isn't enough space! {number_of_tourists} people in a queue!")
- print(" ".join(full_wagon))
- else:
- print("The lift has empty spots!")
- print(" ".join(full_wagon))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement