LCA倍增+大眼观察 #include<bits/stdc++.h> using namespace std; int n,m,a,b,ne,c,head[1001000],fa[501000][26],d[501000]; struct node{int nxt,v;}eg[1001000]; v Read More
复习一下树的直径,多次dfs求解 #include<bits/stdc++.h> using namespace std; int n,m,a,b,ne,c,tpo=1,tp=1,head[405000]; long long ans,d[205000][2],dl[205000]; struct Read More
#include<bits/stdc++.h> using namespace std; int n,m,a,b,c,ne,tot,head[100008*30],ch[100008*30][3];long long val[100008*30],ans=-1; struct node{int nx Read More