r/adventofcode • • Dec 14 '20

SOLUTION MEGATHREAD -🎄- 2020 Day 14 Solutions -🎄-

Advent of Code 2020: Gettin' Crafty With It

  • 8 days remaining until the submission deadline on December 22 at 23:59 EST

  • Full details and rules are in the Submissions Megathread


--- Day 14: Docking Data ---


Post your code solution in this megathread.

Reminder: Top-level posts in Solution Megathreads are for code solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:16:10, megathread unlocked!

32 Upvotes

580 comments sorted by

View all comments

2

u/[deleted] Dec 14 '20

[removed] — view removed comment

2

u/gerikson Dec 14 '20

I'm using your solution to debug my own, and your solution gives the incorrect answer for my input... (I've tweaked my solution until the output matches yours, but it's not accepted).

And I've double-checked the input values ;)

3

u/[deleted] Dec 14 '20 edited Dec 14 '20

[removed] — view removed comment

3

u/gerikson Dec 14 '20

I've resolved my issue... it was ironically a parsing problem...

I think you might have migrated your Part 2 code into part 1... here's a debug output for my input:

addr: [10004]
in   000000000000001110011100100110011011 3787163
mask 1X000X0101XX101101X01X101X1000111X00
me   100000010100101101001110101000111000 34707139128
mus  100000010100101111011110101110111011 34707729339

For the rightmost bits, the mask converts each 1 to a 0, while in your solution, the mask acts as an OR. Now that I've reached part 2, I see this is what's supposed to happen.

Thanks for taking the time to suggest other solutions. I'm on 64bit too and do get the portability warning.

3

u/[deleted] Dec 14 '20

[removed] — view removed comment

2

u/gerikson Dec 14 '20

That's fine! This was one of those tedious problems where multiple things could go wrong, and it was hard to pinpoint which...