filmov
tv
I finished 4th overall in Advent of Code 2023!

Показать описание
Advent of Code 2023, Day 25. I finished 38th on part 1 and 34th on part 2 (clicking the button). This was enough to take me into 4th place on the global leaderboard!!!
At first I missed the "remove 3 edges" bit and thought it was just asking us to find the 2 different connected components, which I wrote and got a wrong answer for - then I read more carefully and realized. From there I thought about a few things including min-cut, but I saw the leaderboard filling up and thought there was no way people were writing min-cut that quickly (or that many had prewritten implementations for it) so I wasted a bit of time thinking about heuristic-y approaches.
I thought about NetworkX, which I have installed, but since I had literally never used it before I was a little apprehensive about the time it would take me to figure out how to do basic stuff with us - luckily for me, the documentation page for [minimum_cut] is quite good, so it went quite quickly. One hack I did was I just picked a source and a sink node randomly, and kept re-picking until the min-cut was 3. I'm guessing NX has a way to just find min-cut that disconnects the graph anywhere, but since I knew the min-cut value, this was good enough for me.
Really happy about my final finish, 4th was the absolute best-case finish for me going into tonight, and I thought it was pretty unlikely to happen.
As always, thanks for the problems Eric - it's been great this year!
At first I missed the "remove 3 edges" bit and thought it was just asking us to find the 2 different connected components, which I wrote and got a wrong answer for - then I read more carefully and realized. From there I thought about a few things including min-cut, but I saw the leaderboard filling up and thought there was no way people were writing min-cut that quickly (or that many had prewritten implementations for it) so I wasted a bit of time thinking about heuristic-y approaches.
I thought about NetworkX, which I have installed, but since I had literally never used it before I was a little apprehensive about the time it would take me to figure out how to do basic stuff with us - luckily for me, the documentation page for [minimum_cut] is quite good, so it went quite quickly. One hack I did was I just picked a source and a sink node randomly, and kept re-picking until the min-cut was 3. I'm guessing NX has a way to just find min-cut that disconnects the graph anywhere, but since I knew the min-cut value, this was good enough for me.
Really happy about my final finish, 4th was the absolute best-case finish for me going into tonight, and I thought it was pretty unlikely to happen.
As always, thanks for the problems Eric - it's been great this year!
Комментарии