Copyright | (c) Eric Mertens 2021 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
https://adventofcode.com/2021/day/12
Search around a cave visiting some caves more than others.
This solution makes the observation that we can optimize away all the big caves. Big caves can never be connected to other big caves or we'd have infinite cycles, and we don't need to track anything about visiting a big cave.
Documentation
toAdj :: [(Int, Int)] -> IntMap [Int] Source #
Compute directed edge map from a list of undirected edges.
compress :: IntMap [Int] -> IntMap (IntMap Int) Source #
Compute direct paths through a big cave to the next small cave.