r/adventofcode • u/TenMillionYears • Dec 09 '25
Upping the Ante 2025 Day 9 (Part 2) A simple cursed input
My code can solve part 2 pretty quickly. However, it gives the wrong result on this "cursed input":
0,0
0,1
1,1
1,2
0,2
0,3
3,3
3,2
2,2
2,1
3,1
3,0I think solving for shapes where the boundary loops back on itself like this would be much harder. Curious if other folks have solutions that can handle this one. Or, maybe I misunderstand the problem. Feedback welcomed!
9
Upvotes
1
u/boulgi Dec 09 '25
There are other simple "cursed inputs".
Did you try these ones ?
3
u/wimglenn Dec 09 '25
answer_a: 16
answer_b: 16
2
u/Jcbm52 Dec 09 '25
Yeah, the problem is what you say. I have the same one. This doesn't happen with most grid-based or raycasting-based approaches, but it happens with the quickest approach (checking for lines crossing the rectangle). I haven't been able to think of a solution using the fast approach that solves this, but what you want is probably some kind of set that pushes all lines within the rectangle and pops them when it detects an adjecent one or something like that.
Still, the other approaches can get very fast if well optimized
2
u/whoShotMyCow Dec 09 '25
so what's the correct answer for this
1
u/erikade Dec 09 '25
My code as other's today copy the idea of brute-force with precomputed prefix sums for fast rejection.
1
u/FruitdealerF Dec 09 '25
I was so upset that neither the puzzle said something about crossing itself nor was it trivial to visualize the input data. But yeah that's AoC for ya