割边模板
判断方面,没有了割点的root的特判,并且==号去掉 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 using namespace std; 6 const int maxn=1e3+10; 7 8 int dfn[maxn],low[maxn],head[maxn],vis[maxn]; 9 bool judge[maxn]; 10 int k,n,m,num,root; 11 struct Edge{ 12 int to,next; 13 }G[400010]; 14 struct node 15 { 16 int u,v; 17 }sto[maxn]; int cot; 18 //这个大小应该跟边数同步,但这里跟点的个数同步也能过; 19 //大概是因为割边的数量不多吧 20 void build(int u,int v){ 21 G[num].to=v;G[num].next=head[u];head[u]=num++; 22 } 23 24 void Tarjan(int u,int fa){ 25 int son=0; 26 vis[u]=1; //判断是否访问过,当访问完后定为2,不再访问; 27 k++; 28 dfn[u]=k; /