Please read the new rule regarding the restriction on the use of AI tools. ×

qinziao's blog

By qinziao, history, 3 hours ago, In English
Your code here...
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dfs(int u)
{
    if(u==1)
    {
		ll minn=LONG_LONG_MAX;
		for(v|u->v)
		{
			minn=min(dfs(v),minn);
		}
		return value[u]+minn;
	}
	if(son[u]==0)
		return value[u];
	if(son[u]==1)
		return (value[u]+dfs(v))>>1;
	if(son[u]>1)
	{
		ll minn=LONG_LONG_MAX;
		for(v|u->v)
		{
			minn=min(dfs(v),minn);
		}
		return minn;
	}
}
int main()
{
	cout<<dfs(1)<<endl;
	return 0;
}
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by qinziao (previous revision, new revision, compare).

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by qinziao (previous revision, new revision, compare).

»
2 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there any problem for my greedy strategy?

»
2 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by qinziao (previous revision, new revision, compare).