qinziao's blog

By qinziao, history, 3 months 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;
}

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it