Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

额,可不可以详细点稍微,求贪心思路!

Posted by surfacedust at 2011-07-23 11:07:11 on Problem 3659
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator