Skip to content

Commit 6edfdda

Browse files
committed
🎄 Add solution to 2023-12-25
1 parent ea2035e commit 6edfdda

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

2023/day25/solutions.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import networkx as nx
2+
3+
with open("input") as f:
4+
ls = f.read().strip().split("\n")
5+
6+
G = nx.Graph()
7+
for l in ls:
8+
v, *us = l.split()
9+
G.add_edges_from((v[:-1], u) for u in us)
10+
11+
G.remove_edges_from(nx.minimum_edge_cut(G))
12+
a, b = nx.connected_components(G)
13+
print(len(a) * len(b))

0 commit comments

Comments
 (0)