TWOCOMP - Editorial

@1smll: the tag is corrected now. Thanks for point iit out.

I have updated the images.

Thanks! Pictures really help a lot. Great editorial

Just a little note on the cross function implemented in author’s solutions: most of the conditionals are useless there. If a path intersects the other, you can test just if lca 1 is between (s1,t1) or if lca 2 is between (s2,t2).

The simplified version of the cross function is as follows:

bool cross (int x1, int y1, int l1, int x2, int y2, int l2){
        if(anc(l1, l2) && anc(l2, x1)) return true;    
        if(anc(l1, l2) && anc(l2, y1)) return true;    
        if(anc(l2, l1) && anc(l1, x2)) return true;    
        if(anc(l2, l1) && anc(l1, y2)) return true;
        return false;
}