summaryrefslogtreecommitdiffstats
path: root/6np.py
blob: 8d90f1f12ae539f69ddb2655637781e62deb07f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
from collections import Counter
from utils import open_day
import numpy as np

fish = Counter(map(int, open_day(6).read().split(',')))
fish = np.array([fish[i] for i in range(9)])
mat = np.eye(9, 9, -1, dtype=int)
mat[0, [6, 8]] = 1

print(sum(np.matmul(fish, np.linalg.matrix_power(mat, 80))))
print(sum(np.matmul(fish, np.linalg.matrix_power(mat, 256))))