poj 1330 Nearest Common Ancestors LCA tarjan/RMQ ST
题意:给出一棵树,求两点间的最近公共祖先。基于并查集的离线求LCA的tarjan算法:const
maxn=10000;
var
e,p,q,n,l,t,root:longint;
v:array[1..maxn]ofboolean;
f,last:array[1..maxn]oflongint;
side:array[1..maxn]ofrecord
x,y,next:longint;
end