Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- waiting_people = int(input())
- lift_state = [int(s) for s in input().split()]
- the_lift_has_empty_slots = False
- for index in range(len(lift_state)):
- if lift_state[index] == 0 and waiting_people >= 4:
- lift_state[index] += 4
- waiting_people -= 4
- else:
- if lift_state[index] > 0:
- dif = abs(lift_state[index] - 4)
- else:
- dif = waiting_people
- the_lift_has_empty_slots = True
- lift_state[index] += dif
- waiting_people -= dif
- if the_lift_has_empty_slots:
- print("The lift has empty spots!")
- print(" ".join(map(str, lift_state)))
- else:
- if waiting_people == 0:
- print(" ".join(map(str, lift_state)))
- else:
- print(f"There isn't enough space! {waiting_people} people in a queue!")
- print(" ".join(map(str, lift_state)))
Advertisement
Add Comment
Please, Sign In to add comment