repositories
/
aoc20.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
one line
[aoc20.git]
/
10
/
one.icl
1
module one
2
3
import StdEnv
4
5
import Data.List
6
import Data.Func
7
8
read :: *File -> [Int]
9
read f
10
# (ok, i, f) = freadi f
11
| not ok = []
12
= [i:read f]
13
14
Start w
15
# (io, w) = stdio w
16
# ls = sort [0:read io]
17
= (one ls, two ls)
18
19
one ls = prod $ map length $ group $ sort [3:[b-a\\a<-ls & b<-tl ls]]
20
21
two ls = prod [[0,1,2,4,7,12,20,33,53]!!length l\\l<-group [b-a\\a<-ls & b<-tl ls] | all ((==)1) l]