Our great sponsors
-
AdventOfCode2021
Solutions to all 25 AoC 2021 problems in Rust :crab: Less than 100 lines per day and under 1 second total execution time! :christmas_tree:
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
My Rust solution runs in about 150ms, using just a standard Dijkstra implementation with nothing special like prioritizing moves like you propose.
I think a full search is quite feasible since the branching stops pretty quickly from bad moves locking up the position. I wrote my solution in rust, and I run through every legal move (okay, I split it up to all moves being first up to the corridor and then a second move down, to simplify coding) from the initial state and it runs on my laptop in 110 ms.
Its not amazingly clear code, but here it is for what its worth: https://github.com/vodik/aoc/blob/main/aoc-2021/src/day23.rs
Thanks so much for sharing! If you would like to test your code against someone else's input data, you can find mine here: https://github.com/jdashton/aoc2021-ruby/blob/main/input/day23a.txt . The accepted answers were 13455 for part 1 and 43567 for part 2.