Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- import sys
- STEPS = 10 ** 6
- FIRST = 0
- SECOND = 1
- first = deque(list(map(int, input().split())))
- second = deque(list(map(int, input().split())))
- for i in range(STEPS):
- if not second:
- print('first ', i)
- sys.exit()
- elif not first:
- print('second ', i)
- sys.exit()
- else:
- game = [first.popleft(), second.popleft()]
- if game[FIRST] == 0 and game[SECOND] == 9:
- first.append(game[FIRST])
- first.append(game[SECOND])
- elif game[FIRST] == 9 and game[SECOND] == 0:
- second.append(game[FIRST])
- second.append(game[SECOND])
- elif game[FIRST] > game[SECOND]:
- first.append(game[FIRST])
- first.append(game[SECOND])
- elif game[FIRST] < game[SECOND]:
- second.append(game[FIRST])
- second.append(game[SECOND])
- print('botva')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement