diff options
author | Hunky Jimpjorps <thechairman@thechairman.info> | 2022-12-12 17:00:12 -0500 |
---|---|---|
committer | Hunky Jimpjorps <thechairman@thechairman.info> | 2022-12-12 17:00:12 -0500 |
commit | b70835069c1bcc8a9ca316b1795de3bfd6d6f12e (patch) | |
tree | 07b1c2cf903bc1905a14c8c1e6fc382a12b533de /2022 | |
parent | 591488cf7c85e4b8bfdbebdce2187bb23c41fa0d (diff) | |
download | gleam_aoc-b70835069c1bcc8a9ca316b1795de3bfd6d6f12e.tar.gz gleam_aoc-b70835069c1bcc8a9ca316b1795de3bfd6d6f12e.zip |
day 12 cleanup
Diffstat (limited to '2022')
-rw-r--r-- | 2022/day-12/day-12.rkt | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/2022/day-12/day-12.rkt b/2022/day-12/day-12.rkt index 9120468..5e0c365 100644 --- a/2022/day-12/day-12.rkt +++ b/2022/day-12/day-12.rkt @@ -35,11 +35,12 @@ (list p neighbor)))) ;; part 1 -(match-define-values (distances _) (dijkstra paths (hash-ref special-points 'start))) -(hash-ref distances (hash-ref special-points 'end)) +(time (match-define-values (distances _) (bfs paths (hash-ref special-points 'start))) + (hash-ref distances (hash-ref special-points 'end))) ;; part 2 -(for/lists (lengths #:result (apply min lengths)) - ([start (in-list (hash-keys terrain-mesh))] #:when (= 0 (hash-ref terrain-mesh start))) - (match-define-values (distances _) (dijkstra paths start)) - (hash-ref distances (hash-ref special-points 'end))) +(time (for/lists + (lengths #:result (apply min lengths)) + ([start (in-list (hash-keys terrain-mesh))] #:when (= 0 (hash-ref terrain-mesh start))) + (match-define-values (distances _) (bfs paths start)) + (hash-ref distances (hash-ref special-points 'end)))) |