Day 8: 358
This commit is contained in:
parent
507a186db4
commit
998dadcce8
1 changed files with 1 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
import Data.List
|
import Data.List
|
||||||
r(p,o)=map(\h->last(h:[p|h==o]))
|
r(p,o)=map(\h->last(h:[p|h==o]))
|
||||||
main=interact$show.((,).sum.map(foldl1$(+).(10*))<*>length.filter(`elem`[1,4,7,8]).concat).map(drop 10.t.filter(/="|").words).lines
|
main=interact$show.((,).sum.map(foldl1$(+).(10*))<*>length.filter(`elem`[1,4,7,8]).concat).map(drop 10.t.filter(<"|").words).lines
|
||||||
t z=head[p|q<-permutations['a'..'g'],Just p<-[mapM((`elemIndex`["012345","12","01346","01236","1256","02356","023456","012","0123456","012356"]).sort.($zip['0'..]q).foldr r)z]]
|
t z=head[p|q<-permutations['a'..'g'],Just p<-[mapM((`elemIndex`["012345","12","01346","01236","1256","02356","023456","012","0123456","012356"]).sort.($zip['0'..]q).foldr r)z]]
|
||||||
|
|
Loading…
Add table
Reference in a new issue