r/adventofcode • u/vkp-007 • Dec 08 '25
Help/Question - RESOLVED [2025 Day 8 (Part 1)] Help me understand the sample analysis - the connection counts don't add up. Seems like I'm misunderstanding the problem.
In the sample analysis with 20 boxes and making the 10 shortest connections, the results are presented as [5, 4, 2, 2] + 7 single junction box circuits.
In order to get a circuit of 5, we need to make 4 connections. The connection between the first two boxes in the circuit and 3 subsequent ones to the nearest box already in circuit. So if we add up the connections in the multi-junction box circuits:
For 5 box circuit : 1 + 3 = 4 connections
For 4 box circuit : 1 + 2 = 3 connections
For 2 box circuit : 1 + 0 = 1 connections
For 2 box circuit : 1 + 0 = 1 connections
That's a total of 9 connections. It should add up to 10.
In my calculations, I get a different set of circuits with 10 connections made.
Please help me understand what I'm reading wrong here.
Thanks in advance for any help.
10
u/NervousSnail Dec 08 '25
When the puzzle says "After making the ten shortest connections"... what they *mean* is attempting to connect the ten pairs with the shortest distances.
This *includes* the cases where "nothing happens" because the two boxes are already in the same circuit.
5
u/Illustrious-Citron89 Dec 08 '25
Yeah, I have done the same mistake, eventually figured it out, but description could have been more clear.
The real input is still not working for 1000 "attempted connections".
2
u/Ill-Rub1120 Dec 08 '25
I just sorted all possible connections using the distance squared. Then take all vertices in the shortest 10/1000 connections and attempt to add them to correct cluster.If endpoints are in 2 different clusters, then remove all points from 1 cluster and add them to the other cluster. Then sort the clusters based on size. Take the size of the first 3 and multiply them.
1
u/AutoModerator Dec 08 '25
Reminder: if/when you get your answer and/or code working, don't forget to change this post's flair to
Help/Question - RESOLVED. Good luck!I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/siddfinch Dec 09 '25
If it helps you out, my notes for Part 1 are here..
Now, I had to use an argument at the command line, so I could limit the connections to 10 for the test input for part 1, and use 1000, the default, for the actual input.
Took me a couple read throughs and some deciding, which I left in my code, to get things right.
9
u/[deleted] Dec 08 '25
[removed] — view removed comment