Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
基于贪心,简单dfs(int u,int fa) { vis[u]=1; for(i=0;i<g[u].size();i++) { int v=g[u][i]; bool flag=false; if(!vis[v]) { dfs(v,u); vis[v]=true; flag=flag||over[v]; } if(fa==-1)ans+=!(over[u]||flag); else if(!over[fa]&&!over[u]&&!flag) ans+=over[u]=1; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator