advent-of-code/2020/day10/day10.dyalog
2024-11-12 21:46:18 +01:00

10 lines
334 B
APL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

⎕IO0 ⎕PP15
p¨⎕NGET'input'1
p0,p[p],3+/p
×/2-/p ⍝ Part 1
c0,0,1,(/p)0 ⍝ paths counts
{c[+2]+/c[+¯1 0 1]}¨1p
c ⍝ Part 2
a(0<3).-p ⍝ adjacency matrix
+/{({a+.×})a}¨p ⍝ Part 2, the matrix way