DP Intro - poj 2342 Anniversary party】的更多相关文章

今天开始做老师给的专辑,打开DP专辑 A题 Rebuilding Roads 直接不会了,发现是树形DP,百度了下了该题,看了老半天看不懂,想死的冲动都有了~~~~ 最后百度了下,树形DP入门,找到了 poj 2342 Anniversary party   先入门一下~ 题意: 某公司要举办一次晚会,但是为了使得晚会的气氛更加活跃,每个参加晚会的人都不希望在晚会中见到他的直接上司,现在已知每个人的活跃指数和上司关系(当然不可能存在环),求邀请哪些人(多少人)来能使得晚会的总活跃指数最大. 思路…
POJ 2342 Anniversary party (树形dp 入门题) Anniversary party Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4810   Accepted: 2724 Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The U…
POJ 2342 Anniversary party / HDU 1520 Anniversary party / URAL 1039 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 hierarchical structure of emp…
题目链接:http://poj.org/problem?id=2342 Description 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. It means that the supervisor relation forms a tree…
题目链接:http://poj.org/problem?id=2342 有n个人,每个人有活跃值.下面n-1行u和v表示u的上司是v,有直接上司和下属的关系不能同时参加party,问你party最大的活跃值是多少. 也就是说一棵树中,选择的点不能是相邻的点,且要使活跃值最大. 简单的树形dp,任意选一个点开始遍历,从叶子节点开始回溯. dp[i][0]表示不选i节点最大的活跃度,则dp[i][1]表示选i节点最大的活跃度. i与j相连,dp[i][0] += max(dp[j][0], dp[j…
题目链接:http://poj.org/problem?id=2342 题意:一家公司有1 <= N <= 6 000个职工,现要组织一些职工参加晚会,要求每个职工和其顶头上司不能同时参加晚会,并且每个职工有一个enjoy值,问选取的职工的最大enjoy总和为多少? 输入N个职工各种的enjoy值,和L K表示K是L的顶头上司: 思路:建图之后DFS,dp[u][1] :u去时,以u为根的子树最大enjoy值,dp[u][0]:u不去时,以u为子树的enjoy值: 则dp[u][1] += d…
题目链接:http://poj.org/problem?id=2342 题目大意:在一个公司中,每个职员有一个快乐值ai,现在要开一个party,邀请了一个员工就不可能邀请其直属上司,同理邀请了一个人就不可以邀请其的直属员工, 问如何使得这个快乐值达到最大. 题解:对每个结点dp[i][0]表示不邀请这个员工,其子树达到的最大快乐值,dp[i][1]表示邀请i员工其子树达到的最大值. dp[i][0]=(i的全部员工的max(dp[u][1],dp[u][0)相加,也就是其子员工来或不来的最大快…
Anniversary party Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7230   Accepted: 4162 Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure…
Anniversary party Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3862   Accepted: 2171 Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure…
Anniversary party Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4410   Accepted: 2496 Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure…