5

Holy hell, aoc day 9 part 2 is diabolical!
Has anyone solved it and can give me a hint (not the solution)?

The naive approach would be to make an array with 100000^2 elements, or an image with that many pixels, but that's just too large.
There must be a smarter way.

Comments
  • 1
    Still building an octree for day 8. If I accomplish nothing else for the rest of AoC but finish this, it will have been worthwhile.
  • 0
    https://adventofcode.com/2025/day/9

    Is it this here? I don't see any part 2?

    I have never done aoc before, but I don't see any reason to draw an array here at all. That is not it, is it? That's to easy.. At least the naive solution is easy...

    Where do I go to find part 2?
  • 1
    @TrayKnots you gotta submit part 1 to get part 2. The idea is that part 2 is usually a more complex form of the problem that you shouldn't plan for when you come up with the simpler strategy for part 1.
  • 0
    @lorentz I see. Bother... I cannot see the problem therefore.
  • 0
    @TrayKnots also when you log in you will get your personal input which is much, much larger than the small example.
    For day 9 the x and y coords are in the range of 0 to 100000
  • 1
    @lorentz octree just for fun? Because you can brute force it in seconds ^^
  • 2
    You should ask someone claiming they're genius 😂😂😂
  • 2
    @Lensflare I realized day of that this would be bruteforceable in Rust and probably manageable with just 5x5x5 chunks in Python even, but I think this solution is fun so I'm sticking to it.
  • 2
    @Lensflare I avoid bruteforce solutions in AoC even when they're possible because I think they're boring.
  • 1
    Just had a look at part 2. I don't have time to solve it right now, but my gut tells me that this is a case for a sweep line algorithm.
  • 1
    AoC gets INSANE really quickly. Last year i didn't make it past day 12 i believe lol
  • 1
  • 2
    @lorentz most aoc puzzles are not brute forcable because the explosion of combinations gets too large.
  • 2
    @Lensflare i mean you have to be a _little bit_ smart about it, but just blasting through all 1M combinations of 1000 coordinate triads with a loop is more than feasible. If you avoid expensive operations in the loop, it's indeed a couple of seconds in a compiled language.
Add Comment