diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-12-11 06:30:36 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-12-11 06:30:36 +0100 |
| commit | e5e8007197489a84d2fc3c499efe822642ba682e (patch) | |
| tree | 72666ca39016efa3df9efaee3e9eaa88ad18d8e9 /2025/11/b.py | |
| parent | f8944a95b16e2b09ad0d1b61ee5ba37d2755807f (diff) | |
| download | aoc-e5e8007197489a84d2fc3c499efe822642ba682e.tar.gz aoc-e5e8007197489a84d2fc3c499efe822642ba682e.zip | |
Day 11 2025
Diffstat (limited to '2025/11/b.py')
| -rw-r--r-- | 2025/11/b.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/2025/11/b.py b/2025/11/b.py new file mode 100644 index 0000000..8fdcc8b --- /dev/null +++ b/2025/11/b.py | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | import fileinput | ||
| 2 | from functools import cache | ||
| 3 | |||
| 4 | a = {} | ||
| 5 | with fileinput.input() as lines: | ||
| 6 | for line in lines: | ||
| 7 | v, l2 = line[:-1].split(': ') | ||
| 8 | a[v] = l2.split(' ') | ||
| 9 | |||
| 10 | @cache | ||
| 11 | def np(v, d, f): | ||
| 12 | if v == 'out': | ||
| 13 | return 1 if d and f else 0 | ||
| 14 | return sum(np(w, d or v == 'dac', f or v == 'fft') for w in a[v]) | ||
| 15 | |||
| 16 | print(np('svr', False, False)) | ||
