Solve 2025 day 12 pt 1-2

Got this one ruined due to a post not masking
spoilers:

https://www.reddit.com/r/adventofcode/comments/1pkxibs/2025_day_25_part_1_still_pretty_clueless_why_its/

Basically, ignore the test case and just wing it by
asuming the 3x3 can be placed without overlaps. Id
the number of shapes * 3x3 is bigger than the available
canvas, it won't fit.

A naive first check to do before making premature
optimizations.

I would have gone the zip() hell route to prove
it actually works, but after grasping at the puzzle
input i realized it would tka a looong time to
calculate.
This commit is contained in:
Anders Englöf Ytterström 2025-12-14 22:41:23 +01:00
parent 01bfcc1351
commit 11137463c7

View file

@ -0,0 +1,26 @@
from output import ints
def solve(data):
p1 = 0
data = data.split("\n\n")
Q = data.pop().splitlines()
for q in Q:
W, H, *C = ints(q)
if W * H >= sum(C) * 9:
p1 += 1
p2 = "God jul!"
return p1, p2
if __name__ == "__main__":
with open("./input/12.txt", "r") as f:
inp = f.read().strip()
p1, p2 = solve(inp)
print(p1)
print(p2)
assert p1 == 440
assert p2 == "God jul!"