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 962861784 at 2011-06-17 22:09:10 on Problem 3659
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