记录编号 | 153704 | 评测结果 | AAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | 备用交换机 | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 0.003 s | ||
提交时间 | 2015-03-18 20:04:47 | 内存使用 | 0.32 MiB | ||
#include<cstdio> #include<string> #include<deque> #include<iostream> using namespace std; int n,co[110]={0},g[110],low[110],tim=0,hs[110]={0},ans=0; deque<int> e[101]; int tarjian(int x) { int tot=0; low[x]=g[x]=++tim; co[x]=1; for(int i=0;i<e[x].size();i++) { int w=e[x][i]; if(co[w]==0) { tot++; tarjian(w); low[x]=min(low[x],low[w]); if(g[x]!=1&&low[w]>=g[x]&&hs[x]==0) { ans++; hs[x]=1; } else if(g[x]==1&&tot>1&&hs[x]==0) { ans++; hs[x]=1; } } else { low[x]=min(low[x],g[w]); } } co[x]=2; return 0; } int main() { freopen("gd.in","r",stdin); freopen("gd.out","w",stdout); scanf("%d",&n); int a,b; while(scanf("%d%d",&a,&b)==2) { string st; //cout<<a<<" "<<b<<endl; e[a].push_back(b); e[b].push_back(a); } tarjian(1); //cout<<g[1]<<endl; cout<<ans<<endl; for(int i=1;i<=n;i++) { if(hs[i]==1) cout<<i<<endl; } return 0; }