https://www.luogu.org/problem/P3469
That is a subject of the blockade points, which will lead to point (to) even unreasonable;
Cutpoint with tarjan seeking, if the cut point is a point, the point impassable number is (multiplication rule) is multiplied by the size of the subtrees son + n-1;
If the point is not cut n-1;
#include<cstring> #include<cstdio> #include<algorithm> using namespace std; const int maxn=5e5+10; int pre[maxn*2],last[maxn],other[maxn*2],l; int n,m; void add(int x,int y) { l++; pre[l]=last[x]; last[x]=l; other[l]=y; } bool vis[maxn]; long long ans[maxn]; int dfn[maxn],cnt,low[maxn],siz[maxn],fa[maxn]; void dfs(int x) { dfn[x]=low[x]=++cnt; vis[x]=1; siz[x]=1; int ss=0; for(int p=last[x];p;p=pre[p]) { int v=other[p]; if(!vis[v]) { fa[v]=x; dfs(v); siz[x]+=siz[v]; Low [X] = min (Low [X], Low [V]); IF (Low [V]> = DFN [X] && FA [X] = V!) // the son node can not bypass this point reaches above node { ANS [X] + = ( Long Long ) SS * SIZ [V]; // have already been calculated are blocked by the sons now SS = + SIZ [V]; // update } } the else Low [X ] = min (Low [X], DFN [V]); } ANS [X] + = ( Long Long ) (N- . 1 ); ANS [X] + = ( Long Long ) SS * (n--SS- . 1 ); //Blocked son multiplied not blocked } int main () { Scanf ( " % D% D " , & n-, & m); for ( int I = . 1 ; I <= m; I ++ ) { int A, B ; Scanf ( " % D% D " , & A, & B); the Add (A, B); the Add (B, A); } DFS ( . 1 ); for ( int I = . 1 ; I <= n-; I ++ ) { the printf ( " % LLD \ n- " , ANS [I] * 2 ); //Point ordered } return 0 ; }