1 import Data.Map.Strict as M
2 import Data.Map.Strict ((!))
5 data Coins = Red | Blue | Shiny | Corroded | Concave
6 deriving (Ord, Eq, Show, Enum, Bounded)
8 allCoins = [Red .. Concave]
12 coins :: M.Map Coins Int
13 coins = M.fromList $ zip [Red .. Concave] [2, 9, 5, 3, 7]
16 solve = [ [a, b, c, d, e]
17 | [a, b, c, d, e] <- permutations allCoins
18 , (coins ! a) + (coins ! b) * (coins ! c) ^2 + (coins ! d) ^3 - (coins ! e) == 399