Day 3: 268

This commit is contained in:
Christoph Stahl 2021-12-03 22:39:54 +01:00
parent 03725c8045
commit e55fee94b1

View file

@ -5,6 +5,6 @@ m=map
l=length
d=foldr(\x y->2*y+x)0.reverse
(#)q=h.q.sortBy((.l).compare.l).group.sort
f%x|x==[[]]=[]|i<-f#h(e x)=i:f%[u|y:u<-x,y==i]
t x=d(last%x)*d(h%x)
main=interact$show.((,).t<*>((*)<*>(-)4095).d.m(h#).e).m(m((-48+).fromEnum)).lines
x%f|x==[[]]=[]|i<-f#h(e x)=i:[u|y:u<-x,y==i]%f
t x=d(x%last)*d(x%h)
main=interact$show.((,).t<*>((*)<*>(-)4095).d.m(h#).e).m(m(read.pure)).lines