Skip to content

Commit 039c283

Browse files
committed
Add day12, 2025
1 parent a4ba2a0 commit 039c283

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

2025/day12/solution.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import re
2+
with open("input") as f:
3+
*raw_shapes, regions = f.read().strip().split("\n\n")
4+
5+
regions = regions.split("\n")
6+
shapes = []
7+
for shape in raw_shapes:
8+
shapes.append({(x, y) for y, line in enumerate(shape.split()[1:]) for x, c in enumerate(line) if c == "#"})
9+
10+
ans = 0
11+
for region in regions:
12+
w, l, *ns = list(map(int, re.findall(r"\d+", region)))
13+
ans += sum(n*len(shape) for n, shape in zip(ns, shapes)) <= w*l
14+
15+
print(ans)

0 commit comments

Comments
 (0)