Help for this page

Select Code to Download


  1. or download this
    # -- input --
    
    ...
    
    time complexity:
    O(n)  (without the unneccesary sort)
    
  2. or download this
    %lookup = map { join(',', $_->[0], $_->[1]) => join(',', $_->[2], $_->
    +[3]) } @r;
    
    ...
       die("broken or repeat!\n") unless defined($next);
    }
    while ($next ne $start);