There's really nothing to say about this question ... Naked cut point directly on the template
1#include <cstdio>2#include <cstring>3#include <iostream>4#include <vector>5 #defineMAXN 11006 7 using namespacestd;8 9vector<int>G[MAXN];Ten intDFN[MAXN],LOW[MAXN]; One intVIS[MAXN],CNT[MAXN]; A intk=1, f=0, index=0, M; - voidDfsintx) - { the //cout<< "1" <<endl; - intC=0; - for(intI=0; I<g[x].size (); i++) - { + intE=G[x][i]; - if(vis[e]==0) + { Adfn[e]=low[e]=++index; atvis[e]=1; - DFS (e); -low[x]=min (low[e],low[x]); - if(low[e]>=Dfn[x]) - { -cnt[x]++; in } - } to Elselow[x]=min (low[x],dfn[e]); + } - } the voidSolve () * { $f=index=0;Panax Notoginsengmemset (DFN,0,sizeof(DFN)); -memset (CNT,0,sizeof(CNT)); thememset (Vis,0,sizeof(Vis)); +memset (Low,0,sizeof(Low)); Aprintf"Network #%d\n", k++); thevis[1]=1; +dfn[1]=low[1]=++index; -Dfs1); $ if(cnt[1]>=1) cnt[1]--; $ for(intI=1; i<=m;i++) - { - if(Cnt[i]) the { -printf"SPF node%d leaves%d subnets\n", i,cnt[i]+1);Wuyif=1; the } - } Wu if(f==0) printf ("No SPF nodes\n"); -printf"\ n"); About } $ intMain () - { - intb; - while(SCANF ("%d", &a)! =EOF) A { + for(intI=1; i<=maxn;i++) the g[i].clear (); - if(a==0) Break; $scanf"%d",&b); the G[a].push_back (b); the G[b].push_back (a); theM=a<b?b:a; the while(1) - { in intx, y; thescanf"%d",&x); the if(x==0) Break; Aboutscanf"%d",&y); the g[x].push_back (y); the g[y].push_back (x); theM=m>x?m:x; +M=m>y?m:y; - } the solve ();Bayi } the return 0; the}
View Code
poj1523 Naked Cut-point