"solve" 25a

This commit is contained in:
basicbonobo 2023-12-25 17:15:20 +01:00
parent c2601d433a
commit a76baabd68
5 changed files with 2555 additions and 0 deletions

13
cest25 Normal file
View File

@ -0,0 +1,13 @@
jqt: rhn xhk
rsh: frs pzl lsr
xhk: hfx
cmg: qnr nvd lhk
rhn: xhk bvb hfx
bvb: xhk hfx
pzl: lsr nvd
qnr: nvd
ntq: jqt hfx bvb xhk
nvd: lhk
lsr: lhk
rzs: qnr cmg lsr rsh
frs: qnr lhk lsr

17
dayofxmas.py Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env python3
import networkx as nx
import matplotlib.pyplot as plt
from useful import *
g = nx.Graph()
for line in lines(open(0)):
ic(line)
l, r = line.split(': ')
for rr in r.split():
g.add_edge(l, rr)
print(np.prod([len(l) for l in nx.connected_components(g)]))
#nx.draw(g, with_labels=True)
#plt.show()

1256
input25 Normal file

File diff suppressed because it is too large Load Diff

1256
manual25 Normal file

File diff suppressed because it is too large Load Diff

13
test25 Normal file
View File

@ -0,0 +1,13 @@
jqt: rhn xhk nvd
rsh: frs pzl lsr
xhk: hfx
cmg: qnr nvd lhk bvb
rhn: xhk bvb hfx
bvb: xhk hfx
pzl: lsr hfx nvd
qnr: nvd
ntq: jqt hfx bvb xhk
nvd: lhk
lsr: lhk
rzs: qnr cmg lsr rsh
frs: qnr lhk lsr