Code of the Advent kind, maybe in Go this year
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

11 lines
411 B

#!/usr/bin/env python3
from sys import argv
inp = [({*map(int, y.split())}, {*map(int, z.split())}) for y, z in map(lambda x: x.split(":")[1].split("|"), open(argv[1]).readlines())]
m = [sum(z in x for z in y) for x, y in inp]
print(sum(1 << (a - 1) if a else 0 for a in m))
n = [1 for x in range(len(inp))]
for x in range(len(inp)):
for y in range(x + 1, x + m[x] + 1):
n[y] += n[x]
print(sum(n))