r/adventofcode • • Dec 20 '15

SOLUTION MEGATHREAD --- Day 20 Solutions ---

This thread will be unlocked when there are a significant amount of people on the leaderboard with gold stars.

Here's hoping tonight's puzzle isn't as brutal as last night's, but just in case, I have Lord of the Dance Riverdance on TV and I'm wrapping my presents to kill time. :>

edit: Leaderboard capped, thread unlocked!

We know we can't control people posting solutions elsewhere and trying to exploit the leaderboard, but this way we can try to reduce the leaderboard gaming from the official subreddit.

Please and thank you, and much appreciated!


--- Day 20: Infinite Elves and Infinite Houses ---

Post your solution as a comment. Structure your post like previous daily solution threads.

12 Upvotes

130 comments sorted by

View all comments

Show parent comment

1

u/Blecki Dec 21 '15

Ditto on doing the reverse. I went with your second method first (as the first thing I saw was how to calculate the total presents for a given house). I even attempted a binary search to speed it up, but the only basic assumption I could make to prevent searching the entire space (That, if A<B<C, and no house from B to C has enough presents, that no house from A to B would either) turned out not to be true. I did get a possible answer, and the website told me it was too high, so I was able to do it in 700k instead of 29megs. Which was a bit faster.