hdu 2874 Connections between cities 最近公共祖先lca(离线算法/tarjan算法)
#include
#include
#include
#include
#include
#include
usingnamespacestd;
constintmaxn=1e4+10;
constintmaxc=1e6+10;
structnode{
intto,w;
node(inta=0,intb=0){to=a;w=b;}
};
intf[maxn],dis[maxn],n,ans[max