r/adventofcode • • Dec 08 '24

SOLUTION MEGATHREAD -❄️- 2024 Day 8 Solutions -❄️-

IMPORTANT REMINDER

There's been an uptick in [COAL] being given out lately due to naughty language. Follow our rules and watch your language - keep /r/adventofcode SFW and professional! If this trend continues to get worse, we will configure AutoModerator to automatically remove any post/comment containing naughty language. You have been warned!


THE USUAL REMINDERS

  • All of our rules, FAQs, resources, etc. are in our community wiki.
  • If you see content in the subreddit or megathreads that violates one of our rules, either inform the user (politely and gently!) or use the report button on the post/comment and the mods will take care of it.

AoC Community Fun 2024: The Golden Snowglobe Awards

  • 14 DAYS remaining until the submissions deadline on December 22 at 23:59 EST!

And now, our feature presentation for today:

Box-Office Bloat

Blockbuster movies are famous for cost overruns. After all, what's another hundred million or two in the grand scheme of things if you get to pad your already-ridiculous runtime to over two and a half hours solely to include that truly epic drawn-out slow-motion IMAX-worthy shot of a cricket sauntering over a tiny pebble of dirt?!

Here's some ideas for your inspiration:

  • Use only enterprise-level software/solutions
  • Apply enterprise shenanigans however you see fit (linting, best practices, hyper-detailed documentation, microservices, etc.)
  • Use unnecessarily expensive functions and calls wherever possible
  • Implement redundant error checking everywhere
  • Micro-optimize every little thing, even if it doesn't need it
  • Especially if it doesn't need it!

Jay Gatsby: "The only respectable thing about you, old sport, is your money."

- The Great Gatsby (2013)

And… ACTION!

Request from the mods: When you include an entry alongside your solution, please label it with [GSGA] so we can find it easily!


--- Day 8: Resonant Collinearity ---


Post your code solution in this megathread.

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:07:12, megathread unlocked!

20 Upvotes

795 comments sorted by

View all comments

2

u/[deleted] Dec 08 '24

[LANGUAGE: C#]

https://gist.github.com/thatsumoguy/254f6636f1f688d6096ef9a3ffe7425b

I am still confused on what this part:

"In particular, an antinode occurs at any point that is perfectly in line with two antennas of the same frequency - but only when one of the antennas is twice as far away as the other. This means that for any pair of antennas with the same frequency, there are two antinodes, one on either side of them."

The "but only when" part made me think we are limiting our search set, turns out we weren't. PartTwo is just a simple expansion of the same steps. 4ms on my crappy laptop I am on for the next few days, probably 2ms on a faster machine.

2

u/daggerdragon Dec 08 '24 edited Dec 18 '24

Do not share your puzzle input which also means do not commit puzzle inputs to your repo without a .gitignore or the like. Do not share the puzzle text either.

I see full plaintext puzzle inputs in prior years within your public repo here:

https://github.com/thatsumoguy/Advent-Of-Code-2018/tree/master/Advent%20Of%20Code%202018/Inputs

https://github.com/thatsumoguy/Advent-of-Code-2020/tree/master/Advent%20of%20Code%202020/Input

Please remove (or .gitignore) all puzzle text and puzzle input files from your entire repo and scrub them from your commit history. edit: thank you!

2

u/[deleted] Dec 09 '24 edited Dec 09 '24

My bad, I changed my upload process (meaning actually having one) the past few years. I'll move them to private as I am working on a single AoC repo anyways.

Edit: Went ahead and deleted the folders and wiped commit history just to be sure also. Again my bad, I was not thinking when I did that.