diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2021-12-13 10:12:10 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2021-12-13 10:12:10 +0000 |
commit | dee3d1832176a0caa60770e87ff668811c1ebd8e (patch) | |
tree | 44cc5e910720315c8b50c5070f4b739bb23219ba /12.py | |
parent | 95983a345218edff91ac88a81960babcb2749539 (diff) | |
download | aoc2021-dee3d1832176a0caa60770e87ff668811c1ebd8e.tar.gz aoc2021-dee3d1832176a0caa60770e87ff668811c1ebd8e.tar.xz aoc2021-dee3d1832176a0caa60770e87ff668811c1ebd8e.zip |
day 13
Diffstat (limited to '12.py')
-rw-r--r-- | 12.py | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -10,7 +10,7 @@ with open_day(12) as f: adj[a].add(b) adj[b].add(a) -def count_paths(look_twice=False): +def count_paths(adj, look_twice=False): @cache def f(node, seen, saw_once=None): def descend(node, seen, saw_once): @@ -27,5 +27,5 @@ def count_paths(look_twice=False): return total + descend(node, seen, saw_once) return sum(f(n, frozenset(('start',))) for n in adj['start']) -print(count_paths()) -print(count_paths(True)) +print(count_paths(adj)) +print(count_paths(adj, True)) |