Minimum Spanning Tree by notogawa

import List
main=interact$f.sortBy((.h).compare.h).lines
f x=do(a,b)<-zip x$iterate(`div`2)$g$x!!1;"TF"!!(0^mod b 2):' ':a++"\n"
g x|x<"v"=415835840511|x<"w"=70424461311|0<1=35185952292863
h n=read$words n!!2::Int

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

download

return to the top page