about summary refs log tree commit diff
path: root/day17.k
blob: 535b49568fd6514d71f1af2423f6b6c9d855e0e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/ use q 2016.03.14

d:"veumntbg"

b:1000#" "
w:{$[(#x)<#b;$[3 3~t:+/(-1 0;1 0;0 -1;0 1;0 0)"UDLR"?x; b::x; &/t>-1; w'x,/:"UDLR"@&"a"<,/$2#-15!x; ];]}

w d;
(#d)_b	/ DDRRULRDRD

l:0
u:{$[&/4 4>|/t:+\(-1 0;1 0;0 -1;0 1;0 0)@"UDLR"?x; $[3 3~s:*|t; l::l|#x; $[&/s>-1; u'x,/:"UDLR"@&"a"<,/$2#-15!x;]];]}

u d;
l-#d	/ 536