aoc2025/day12.py
2025-12-22 08:57:57 +01:00

38 lines
956 B
Python

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)