Code Festival B Union Find by kimiyuki

<>;sub r{$j=$t[my$i=pop];$j?$t[$i]=r($j):$i}s/ \d+//,$p=(r$&)-(r$'),$`&&print($p?NO:YES,$/)||$p&&($t[r$&]=$')for<>

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

download

return to the top page