Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- waves = int(input())
- plates = list(map(int, input().split()))
- attack = 0
- while plates:
- if waves == 0:
- break
- wave = list(map(int, input().split()))
- waves -= 1
- attack += 1
- if attack == 3:
- plates.append(int(input()))
- attack = 0
- while wave:
- if len(plates) == 0:
- break
- if wave[-1] > plates[0]:
- wave[-1] -= plates[0]
- plates.pop(0)
- elif wave[-1] < plates[0]:
- plates[0] -= wave[-1]
- wave.pop()
- elif wave[-1] == plates[0]:
- wave.pop()
- plates.pop(0)
- if plates:
- print('The Spartans successfully repulsed the Trojan attack.')
- print(f"Plates left: {', '.join(map(str, plates))}")
- elif wave:
- print('The Trojans successfully destroyed the Spartan defense.')
- print(f"Warriors left: {', '.join(reversed([str(x) for x in wave]))}")
Advertisement
Add Comment
Please, Sign In to add comment