sln_2015_13
Copyright(c) Eric Mertens 2021
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellNone
LanguageHaskell2010

Main

Description

https://adventofcode.com/2015/day/13

>>> :{
:main +
  "Alice would gain 54 happiness units by sitting next to Bob.\n\
  \Alice would lose 79 happiness units by sitting next to Carol.\n\
  \Alice would lose 2 happiness units by sitting next to David.\n\
  \Bob would gain 83 happiness units by sitting next to Alice.\n\
  \Bob would lose 7 happiness units by sitting next to Carol.\n\
  \Bob would lose 63 happiness units by sitting next to David.\n\
  \Carol would lose 62 happiness units by sitting next to Alice.\n\
  \Carol would gain 60 happiness units by sitting next to Bob.\n\
  \Carol would gain 55 happiness units by sitting next to David.\n\
  \David would gain 46 happiness units by sitting next to Alice.\n\
  \David would lose 7 happiness units by sitting next to Bob.\n\
  \David would gain 41 happiness units by sitting next to Carol.\n"
:}
330
286
Synopsis

Documentation

data E Source #

Constructors

Egain 
Elose 

Instances

Instances details
Show E Source # 
Instance details

Defined in Main

Methods

showsPrec :: Int -> E -> ShowS #

show :: E -> String #

showList :: [E] -> ShowS #

data Edge Source #

Constructors

Edge String String 

Instances

Instances details
Eq Edge Source # 
Instance details

Defined in Main

Methods

(==) :: Edge -> Edge -> Bool #

(/=) :: Edge -> Edge -> Bool #

Ord Edge Source # 
Instance details

Defined in Main

Methods

compare :: Edge -> Edge -> Ordering #

(<) :: Edge -> Edge -> Bool #

(<=) :: Edge -> Edge -> Bool #

(>) :: Edge -> Edge -> Bool #

(>=) :: Edge -> Edge -> Bool #

max :: Edge -> Edge -> Edge #

min :: Edge -> Edge -> Edge #

main :: IO () Source #

>>> :main
733
725

maximumHappiness Source #

Arguments

:: Map Edge Int

Happiness effects of each edge

-> [String]

List of all people to be seated

-> Int

Maximum happiness effect

uniques :: Ord a => [a] -> [a] Source #