This commit is contained in:
Stefan Harmuth 2025-12-22 08:57:57 +01:00
parent edc59f45ba
commit fc55b91f7c
3 changed files with 1100 additions and 0 deletions

37
day12.py Normal file
View File

@ -0,0 +1,37 @@
from tools.aoc import AOCDay
from typing import Any
from tools.grid import Grid
class Day(AOCDay):
inputs = [
[
#(2, "input12_test"), # the test is a lie
(544, "input12"),
],
[
(None, "input12"),
]
]
def part1(self) -> Any:
blocks = self.getMultiLineInputAsArray()
presents = {int(p[0][0]): Grid.from_data(p[1:], translate={'#': True, '.': False}).getOnCount() for p in blocks[:-1]}
ans = 0
for tree in blocks[-1]:
dim, pw = tree.split(": ")
row, col = map(int, dim.split("x"))
grid_size = row * col
present_size = sum(x * presents[i] for i, x in enumerate(map(int, pw.split())))
if present_size < grid_size:
ans += 1
return ans
def part2(self) -> Any:
return ""
if __name__ == '__main__':
day = Day(2025, 12)
day.run(verbose=True)

1030
inputs/input12 Normal file

File diff suppressed because it is too large Load Diff

33
inputs/input12_test Normal file
View File

@ -0,0 +1,33 @@
0:
###
##.
##.
1:
###
##.
.##
2:
.##
###
##.
3:
##.
###
##.
4:
###
#..
###
5:
###
.#.
###
4x4: 0 0 0 0 2 0
12x5: 1 0 1 0 2 2
12x5: 1 0 1 0 3 2