Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- from itertools import cycle
- def day9(players, marbles):
- circle = deque([0])
- points = [0] * players
- for p, m in zip(cycle(range(players)), range(1, marbles + 1)):
- if m % 23:
- circle.rotate(2)
- circle.append(m)
- else:
- circle.rotate(-7)
- points[p] += m + circle.pop()
- return max(points)
Add Comment
Please, Sign In to add comment