//求出两两lca,其中有两个相同,答案则为另一个
#include<iostream>
#include<cstdio>
using namespace std;
struct data{
int to,next;
}e[1000001];
int n,m,cnt,head[500001],deep[500001],fa[500001][20];
bool vis[500001];
inline int read(){
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x*=10;x+=ch-'0';ch=getchar();}
return x*f;
}
void insert(int u,int v){e[++cnt]=(data){v,hea......
阅读全文