无向图求割点和连通块。
1 /* POJ2117 */ 2 #include3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 10 #define MAXN 1000511 12 vector vc[MAXN];13 int low[MAXN], pre[MAXN];14 int n, m;15 int dfs_clock, ans, link;16 17 void init() {18 int i;19 20 for (i=0; i = pre[u]) {40 ++cnt;41 }42 } else if (pre[v] 1)48 ans = max(ans, child-1);49 } else {50 ans = max(ans, cnt);51 }52 }53 54 int main() {55 int i, j, k;56 57 #ifndef ONLINE_JUDGE58 freopen("data.in", "r", stdin);59 freopen("data.out", "w", stdout);60 #endif61 62 while (scanf("%d %d",&n,&m)!=EOF && (n||m)) {63 if (m == 0) {64 printf("%d\n", n-1);65 continue;66 }67 init();68 for (i=0; i