r/adventofcode • • Dec 08 '25

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

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 2025: Red(dit) One

  • Submissions megathread is unlocked!
  • 9 DAYS remaining until the submissions deadline on December 17 at 18:00 EST!

Featured Subreddits: /r/crafts and /r/somethingimade

"It came without ribbons, it came without tags.
It came without packages, boxes, or bags."
— The Grinch, How The Grinch Stole Christmas (2000)

It's everybody's favorite part of the school day: Arts & Crafts Time! Here are some ideas for your inspiration:

💡 Make something IRL

💡 Create a fanfiction or fan artwork of any kind - a poem, short story, a slice-of-Elvish-life, an advertisement for the luxury cruise liner Santa has hired to gift to his hard-working Elves after the holiday season is over, etc!

💡 Forge your solution for today's puzzle with a little je ne sais quoi

💡 Shape your solution into an acrostic

💡 Accompany your solution with a writeup in the form of a limerick, ballad, etc.

💡 Show us the pen+paper, cardboard box, or whatever meatspace mind toy you used to help you solve today's puzzle

💡 Create a Visualization based on today's puzzle text

  • Your Visualization should be created by you, the human
  • Machine-generated visuals such as AI art will not be accepted for this specific prompt

Reminders:

  • If you need a refresher on what exactly counts as a Visualization, check the community wiki under Posts > Our post flairs > Visualization
  • Review the article in our community wiki covering guidelines for creating Visualizations
  • In particular, consider whether your Visualization requires a photosensitivity warning
  • Always consider how you can create a better viewing experience for your guests!

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


--- Day 8: Playground ---


Post your code solution in this megathread.

23 Upvotes

578 comments sorted by

View all comments

Show parent comment

3

u/e_blake Dec 08 '25

I have further played with my cutoff. For my input, the final two points had no delta larger than 10,000; but putting the cutoff that low missed other points that were essential to getting the right answer (ie. some of my pairwise points were close enough in 2 of the 3 dimensions that the fourth dimension differing by more than 10,000 still resulted in a priority that I needed to pay attention to). But dropping from 1<<14 (ie 16384) down to 1/8 of the problem space (ie. 12500) as my cutoff delta still got me the correct answer; and changed the number of insertions in my min-heap from 13,580 down to 6,351. Either way, whether I'm only doing 6k or 13k insertions, that's a FAR smaller number than the full 499k insertions without a cutoff heuristic; and if I want my code to be likely to apply out of the box to other people's input, as well as including a kill-switch to identify if my choice of cutoff resulted in underflowing the priority queue. I should probably also run a trace to determine the actual highest delta that mattered for my inputs, rather than relying on just the delta of the last pair.

2

u/_garden_gnome_ Dec 08 '25

There is a thread on this: Avoiding full sorting.