#pragma comment(linker, "/STACK:102400000,102400000") #include #include #include #include #include #include const int maxn=1e5+1000; const int maxm=maxn*2; using namespace std; struct Edge { int u; int v; Edge(){} Edge(int su,int sv) { u=su; v=sv; } }; int e,n,m,nxt[maxm],head[maxn],pnt[maxm],dfn[maxn],low[maxn],iscut[maxn],bccno[maxn],dfs_clock,bcc_cnt; vector bcc[maxn]; stack s; int dfs(int u,int fa) { low[u]=dfn[u]=++dfs_clock; int child=0; for(int i=head[u];i!=-1;i=nxt[i]) { if(!dfn[pnt[i]]) { s.push(Edge(u,pnt[i])); child++; low[u]=min(low[u],dfs(pnt[i],u)); if(dfn[u]<=low[pnt[i]]) { iscut[u]=true; bcc_cnt++; bcc[bcc_cnt].clear(); for(;;) { Edge x=s.top(); s.pop(); if(bccno[x.u]!=bcc_cnt) { bcc[bcc_cnt].push_back(x.u); bccno[x.u]=bcc_cnt; } if(bccno[x.v]!=bcc_cnt) { bcc[bcc_cnt].push_back(x.v); bccno[x.v]=bcc_cnt; } if(x.u==u&&x.v==pnt[i]) break; } } } else if(dfn[pnt[i]]