专题训练之双连通
桥和割点例题+讲解:hihocoder1183 http://hihocoder.com/problemset/problem/1183 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #include<vector> 5 #include<set> 6 using namespace std; 7 const int maxn=1005; 8 const int maxm=200010; 9 struct edge{ 10 int to,nxt; 11 bool cut; 12 }edge[maxm*2]; 13 int head[maxn],tot; 14 int low[maxn],dfn[maxn]; 15 int index,n,bridge; 16 set<int>st; 17 bool cut[maxn]; 18 19 void addedge(int u,int v) 20 { 21 edge[tot].to=v; 22 edge[tot].nxt=head[u]; 23 edge[tot].cut=false; 24 head[u]=tot++; 25 } 26 27 void tarjan(int u,int pre) 28 { 29 low[u]=dfn[u]=++index; 30