#include<iostream>
#include<cstdlib>
#include<cstdio>
#define N 100001
#define inf 0x7fffffff
using namespace std;
int n,cnt=1,sz,head[N],deep[N],size[N],pos[N],belong[N],fa[N][17],id[N];
struct edge{int to,next,v;}e[N<<1];
struct seg{int l,r,mx,c,a;}node[N<<2];
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=x*10+ch-'0';ch=getchar();}
return x......
阅读全文