Minimum Spanning Tree by I., S.(less slow)

(wd@(;:inv)@;~"_1'TF'{~2=/\~.@,<@((]+./ .*1"_`[`]})|:@>)^:_/\.&.|.@(=@[;;/@i.)}:"1)(;:/:0&do)];._1(,stdin)LF

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top