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 |
额,可不可以详细点稍微,求贪心思路!In Reply To:基于贪心,简单 Posted by:962861784 at 2011-06-17 22:09:10 > 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