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.
26 lines
456 B
Python
26 lines
456 B
Python
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!"
|