Compare commits
80
Commits
e6293fe077
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef764ef2be | ||
|
|
2b2261905f | ||
|
|
0b6a222015 | ||
|
|
5757e5fb19 | ||
|
|
9a0e5314e3 | ||
|
|
fcf7546442 | ||
|
|
e478cf9030 | ||
|
|
4bd6014a6e | ||
|
|
3aa0c74003 | ||
|
|
3298e5cc8a | ||
|
|
e88cfd643a | ||
|
|
638d856417 | ||
|
|
6069495db4 | ||
|
|
9d6ae2527b | ||
|
|
b64d593a51 | ||
|
|
73c816e5a7 | ||
|
|
201077b551 | ||
|
|
4ae9fde7e9 | ||
|
|
dc4447ccfb | ||
|
|
369e4c1e63 | ||
|
|
90756ec10c | ||
|
|
cac6ced738 | ||
|
|
6d87bf0038 | ||
|
|
731ce4b177 | ||
|
|
e48758bd3a | ||
|
|
b3306371b3 | ||
|
|
4790d7bc53 | ||
|
|
4a5a3ba757 | ||
|
|
312113ce81 | ||
|
|
5f260fcfe2 | ||
|
|
f63d67f005 | ||
|
|
435d4c6c83 | ||
|
|
5c59e7b253 | ||
|
|
1240614f8a | ||
|
|
a0f796a565 | ||
|
|
b6da96e170 | ||
|
|
62dd0c0e52 | ||
|
|
101cc2c706 | ||
|
|
6b6484ffe8 | ||
|
|
0b66c3c2af | ||
|
|
9a176b9d42 | ||
|
|
bc158d12e1 | ||
|
|
0c3db95461 | ||
|
|
5c5690a4a3 | ||
|
|
2d80356ca8 | ||
|
|
f617998624 | ||
|
|
897400f921 | ||
|
|
e51448bd84 | ||
|
|
c0d74d7cec | ||
|
|
0bf436ef6b | ||
|
|
7104e413c0 | ||
|
|
98271c45de | ||
|
|
6aec568b24 | ||
|
|
a1b8159007 | ||
|
|
8086e4b37c | ||
|
|
2e96f47274 | ||
|
|
077485197b | ||
|
|
f622a647c7 | ||
|
|
66451e31d2 | ||
|
|
7ddf003c8b | ||
|
|
cab8e7ad77 | ||
|
|
230daf810d | ||
|
|
97ddc36b62 | ||
|
|
7c3d439f6e | ||
|
|
599212dd27 | ||
|
|
189ef26780 | ||
|
|
c7153500fd | ||
|
|
a905d491a7 | ||
|
|
fd55e976ae | ||
|
|
805d09a907 | ||
|
|
546ded339f | ||
|
|
82d7c8fa19 | ||
|
|
15abedf260 | ||
|
|
ae82a38816 | ||
|
|
f50e78bf86 | ||
|
|
806cffee14 | ||
|
|
ee409dc842 | ||
|
|
0608b23e2a | ||
|
|
c80e170137 | ||
|
|
ac4b409df4 |
No files matched your search
@@ -1 +1,2 @@
|
||||
AoC2021/Bene/
|
||||
__pycache__
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,28 @@
|
||||
#!/bin/env python3
|
||||
import sys
|
||||
import string
|
||||
from collections import Counter
|
||||
|
||||
def isSmall(node): return all(c in string.ascii_lowercase for c in node)
|
||||
|
||||
def ext(path, ns, visits=1):
|
||||
if path[-1] == 'end': return (yield path)
|
||||
for n in ns[path[-1]]:
|
||||
if n == 'start': continue
|
||||
ext = path + (n,)
|
||||
m = list(map(lambda x: x[1], Counter(n for n in ext if isSmall(n)).most_common(2)))
|
||||
if m[0] > visits or len(m) > 1 and m[1] > 1: continue
|
||||
yield ext
|
||||
|
||||
if __name__ == '__main__':
|
||||
edges = [line.strip().split('-') for line in open(sys.argv[1])]
|
||||
ns = { n: set() for e in edges for n in e }
|
||||
for a,b in edges: ns[a].add(b); ns[b].add(a)
|
||||
|
||||
ps = set([('start',)])
|
||||
while (n := set(np for p in ps for np in ext(p, ns))) != ps: ps = n
|
||||
print(len(ps))
|
||||
|
||||
ps = set([('start',)])
|
||||
while (n := set(np for p in ps for np in ext(p, ns, visits=2))) != ps: ps = n
|
||||
print(len(ps))
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 585 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user