Anniversary party poj-2342 题目大意:没有上司的舞会原题。 注释:n<=6000,-127<=val<=128. 想法:其实就是最大点独立集。我们介绍树形dp 树形dp就是以节点或者及其子树为信息,进行动态规划。用dfs的原理,遍历,在回溯是更新父亲节点。 然后,关于这道题 ...
分类:
其他好文 时间:
2018-03-08 13:53:13
阅读次数:
136
题目 题目 分析 带权值的树上最大独立集 代码 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn=6005; 4 int a[maxn], n, fa[maxn]; 5 vector<int> son[maxn]; ...
分类:
其他好文 时间:
2018-02-01 23:07:56
阅读次数:
202
URAL 1039 思路: 树形dp 状态:dp[i][0]表示以i为根节点的子树不选取i的最大贡献 dp[i][1]表示以i为根节点的子树选取i的最大贡献 初始状态:dp[i][0]=0(if i is a leaf) dp[i][1]=a[i](if i is a leaf) 状态转移: dp[ ...
分类:
其他好文 时间:
2018-01-31 11:30:54
阅读次数:
161
There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees ...
分类:
其他好文 时间:
2017-11-03 00:10:03
阅读次数:
208
题目描述 某大学有N个职员,编号为1~N。他们之间有从属关系,也就是说他们的关系就像一棵以校长为根的树,父结点就是子结点的直接上司。现在有个周年庆宴会,宴会每邀请来一个职员都会增加一定的快乐指数Ri,但是呢,如果某个职员的上司来参加舞会了,那么这个职员就无论如何也不肯来参加舞会了。所以,请你编程计算 ...
分类:
其他好文 时间:
2017-10-29 11:11:04
阅读次数:
175
Anniversary party Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hiera ...
分类:
其他好文 时间:
2017-10-08 22:27:58
阅读次数:
189
Anniversary party Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12770 Accepted Submission(s): 5 ...
分类:
其他好文 时间:
2017-09-29 01:45:42
阅读次数:
209
1 HDU 1520 Anniversary party 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cstdlib> 5 #include <algorithm> 6 #include <qu ...
分类:
其他好文 时间:
2017-09-25 11:55:57
阅读次数:
122
hdu 1520,poj2342 Anniversary party Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12664 Accepted ...
分类:
其他好文 时间:
2017-09-21 23:30:07
阅读次数:
214
zoj 2342 Anniversary party Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9480 Accepted: 5454 Description There is going to be a party to ...
分类:
其他好文 时间:
2017-09-19 03:57:26
阅读次数:
164