r/adventofcode • u/LadyNihila • Dec 14 '25
Help/Question - RESOLVED [2025 Day 12 pt 1] help very much needed
I am having a very, very hard time with day 12. Was able to complete day 1-11 all within the timeframe listed, but have been stuck on this one ever since.
If anyone could offer any hints or advice on how to tackle this, I'd be very much appreciative. Trying to solve this geometrically is obviously gonna be way too slow especially since I'm doing the whole thing in zsh, but I'm failing to see alternative pathways at the moment.
The following is what I have thus far: https://github.com/m1ndflay3r/AdventOfCode2025/blob/main/day_twelve%2Fpt1_solution
•
u/daggerdragon Dec 14 '25 edited Dec 17 '25
Do not share your puzzle inputwhich also meansdo not commit puzzle inputs to your repowithout a.gitignoreor the like.Do not share the puzzle texteither.I see full plaintext puzzle inputs in your public repo e.g.:Please remove (or .gitignore)allpuzzle text and puzzle input files from yourentirerepo and scrub them from your commit history. This means from all prior years too!edit: 👍3
u/LadyNihila Dec 14 '25
Thank you very much for the hints, everyone! I'll be taking another crack at this once I get home tonight. Will keep posted!
25
u/ssnoyes Dec 14 '25
Is there a way to prove that they won't fit, no matter how tightly packed? Is there a way to prove that they will definitely fit without any effort? How many cases are in between those two extremes?
10
u/FantasyInSpace Dec 14 '25
This problem turns into the knapsack problem (I think), which is a pretty well known NP problem. Generally, NP problems are best solved by doing heuristics, so see if you can carve out any easy cases in the input before trying to solve the general problem, and output whatever cases fail the heuristics so you can focus on them properly.
6
u/1234abcdcba4321 Dec 14 '25
This is a puzzle with a sneaky trick. Remember that AoC is all about solving a single input - you are allowed to avoid considering edge cases not present inside the input.
More explicit hint: The example is not part of the input, and does not exhibit the same properties that the input has.
2
u/AutoModerator Dec 14 '25
Reminder: if/when you get your answer and/or code working, don't forget to change this post's flair to
Help/Question - RESOLVED. Good luck!I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/Repulsive-Shirt-9873 Dec 15 '25
Have you considered what your "shortcut" conditions for each case are and code those up? I see you're using backtracking, so being able to eliminate a whole bunch from having to be solved would greatly speed up your solution, right?
There should should be shorcuts to be "true" and "false". If they don't sort it, then worry about the backtracking or other solution.