Copyright | (c) Eric Mertens 2022 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
https://adventofcode.com/2022/day/16
>>>
:{
:main + "Valve AA has flow rate=0; tunnels lead to valves DD, II, BB\n\ \Valve BB has flow rate=13; tunnels lead to valves CC, AA\n\ \Valve CC has flow rate=2; tunnels lead to valves DD, BB\n\ \Valve DD has flow rate=20; tunnels lead to valves CC, AA, EE\n\ \Valve EE has flow rate=3; tunnels lead to valves FF, DD\n\ \Valve FF has flow rate=0; tunnels lead to valves EE, GG\n\ \Valve GG has flow rate=0; tunnels lead to valves FF, HH\n\ \Valve HH has flow rate=22; tunnel leads to valve GG\n\ \Valve II has flow rate=0; tunnels lead to valves AA, JJ\n\ \Valve JJ has flow rate=21; tunnel leads to valve II\n" :} 1651 1707
Synopsis
- main :: IO ()
- solve :: Edges -> Int -> IntMap Int
- data S = S !Int Edges !SmallSet !Int
- newtype Edges = Node [(Edges, SmallSet, Int, Int)]
- renumber :: [(String, Int, [String])] -> (Int, [(Int, Int, [Int])])
- buildEdges :: Int -> IntMap [(Int, Int, Int)] -> Edges
- fw :: [Int] -> IntMap (IntMap Int) -> IntMap (IntMap Int)
Documentation
solve :: Edges -> Int -> IntMap Int Source #
Find the maximum water flow achievable from activating all possible combinations of valves.