ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2025 Day 12 (BaseA Style)

AlteryxCommunityTeam
Alteryx Community Team
Alteryx Community Team

Discussion thread for day 12 of the Advent of Code - https://adventofcode.com/2025/day/12

14 REPLIES 14
ScottLewis
11 - Bolide

Happy Advent, Everyone.

Cannot stress the spoiler part of this one enough.

 

Spoiler
A lesson in floors and ceilings.
Often, while you can't see the answer from looking at a problem, you can bound that problem with a floor or a ceiling. 
This is important because it can define the possibility space you have to search and allow you to discard possible designs that search too much of the space.
In this case, the ceiling is "How many of these trees could fit all the presents if they were packed perfectly."
A lot of them can't.
From there, you could reasonable determine an optimal packing of one of each shape and take out min (count of shapes) from the space, testing only the possible trees and that would possibly eliminate a few more.
Unless the packing was perfect, which it appears to be, in which case the ceiling is the answer. 

Part 2, is, of course, not to be spoken of until you have the rest of your stars.

Final

Spoiler
Day12 2025 Scott Lewis.png 

 

 

CoG
14 - Magnetar

Echoing @ScottLewis , DO NOT check spoilers unless you want this entire day solved with a single glance. It's not as hard as it looks ;) and feels quite good to solve if you can get it. If you're struggling to wrap your mind around this problem, try to think about simple steps you can take, and see what's left after you do that. If you've tried and you're still stumped, then continue reading!

 

Spoiler
With every complex problem, it can help to remove the obvious that would simply get in the way as clutter so that you can invest your focus, effort, and computational time, where it really matters. In this case there are two such obvious cases that you can attend to:

1. If you were somehow able to pack these gifts absolutely perfectly with no gaps that could be filled, how much space would they take up? In my problem there was one piece with a 2-unit deep pit, the center of which was unreachable by any piece, so that can be counted as part of the gift size for that gift.
2. If the area you are working in is sufficiently large, then you could just lay each gift next to the other without any interlocking at all.

In case one, none of those regions would fit the presents, and case two all of those regions would fit the presents quite easily. The best part! All of the regions fit into one of the two categories. So Filter off Case 1 regions and you are done!

Screenshot.png

I enjoyed solving with y'all this year! Thanks for all your efforts and encouragement. Y'all are a blast to work with! Here's to next year!!! So glad I was able to finish Day 10 just before Day 12 released.

Happy Solving!

 

gawa
16 - Nebula
16 - Nebula
Spoiler
image.png

My advice is "Don't try rigorous approach."

Hub119
12 - Quasar
12 - Quasar

Like @ScottLewis and @CoG mentioned this one turned out to be much simpler than I thought it would be...

Spoiler
I started by building out a simple test to see what plots could even be remotely possible for this to work based on overall available plot area, number of presents of a given type needed, and number of spaces each would take up (assuming a perfect arrangement where they all interlock perfectly).  With the potential viable test cases prepped I was ready to go further (see next spoiler for 🤣). Based on a "don't overcomplicate this" comment from @CoG I decided to just try throwing my existing viable plots to test count in as a solution... what do you know? It worked.
AoC 2025 D12 Pic.png
Spoiler
Shape rotation and flipping assembly prep copy/pasted from AoC 2020 Day 20 SolveShape rotation and flipping assembly prep copy/pasted from AoC 2020 Day 20 Solve
Qiu
21 - Polaris
21 - Polaris

In the spirit of keeping it simple...
Can not believe the AoC of the year has completed and I have gotten my first Tree.

Thank you all for the jouney together and the wisdom you have shared.
Happy Upcoming Holidays and wish you all continue to be awesome for the comming year! ❤️

Spoiler
AoC 2025 Day 12.png
DaisukeTsuchiya
14 - Magnetar
14 - Magnetar

Experts told me not to overthink Day12.

Spoiler
I tried an approach that I thought might work. It didn't pass the sample cases, so I gave up and asked @gawa 
for a hint. He told me that while my logic wouldn't work for the sample cases, it would work for the actual problem. I tried it, and it worked!

スクリーンショット 2025-12-12 162330.jpg

 

 

Goddenra
8 - Asteroid

Thoroughly enjoyed this year's competition! Thanks for all the great insights, it's been fascinating to learn some new tools and see how other people tackle problems.

Spoiler
I too listened to the experts and, I don't know, it seems a little easier to get the right answer for Part 1 than it should be. Saying that, I'm not entirely sure how I'd solve it in the way I think it should be. 

Goddenra_0-1765527436416.png

 

No spoilers for Part 2 though I'm afraid. The code does not allow such things. 
DanFlint
8 - Asteroid
Spoiler
DanFlint_1-1765531817688.png

 



Probably too much rearranging the data into the right layout.
Then (at everyones suggestion) tried the easy thing first

DataNath
17 - Castor
17 - Castor

Day 12 done! Had a bunch of fun this year. As someone who falls apart with the more complex challenges due to a lack of mathematical ability or CompSci background, I've appreciated them not being too extreme (with the exception of Day 10 of course)! I think I'll be able to give Part 1 of that a crack but Part 2 seems completely out of reach from what I've heard - this blocks my 24th star as well as that's given upon Day 12 completion and having all stars up to that point. Happy advent all, it's been a blast again!

 

Don't read the spoiler unless you instantly want the method...

 

Spoiler
It turns out there's no need to do any rotating and checking - the actual data set all fits perfectly so it's literally just a check of 'does the area of presents required exceed the area of the tree'?

Workflow.png

 

Labels
Top Solution Authors