Anniversary party Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9354 Accepted: 5400 Description There is going to be a party to celebrate
转载 2017-09-04 21:19:00
48阅读
2评论
Oracle Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 547    Accepted Submission(s): 237 Problem Des
原创 2022-08-11 15:49:13
11阅读
// 题意: 每个节点有权值,子节点和父节点不能同时选,问最后能选的最大价值是多少?// 那么每个点就有两种选择 选或不选了//第一道树形DP,虽然1Y了、不过好慢//HDu上这题居然是多组数据、然后我就超时了、表示还要好好研究//我感觉我不怎么会建树、、#include #include #include #include #include #include #define N 6002using namespace std;vector v[N];bool b[N];int dp[N][2],hp[N];void dfs(int k){ int i,len=v[k].size();...
原创 2021-07-29 16:22:05
109阅读
http://acm.hdu.edu.cn/showproblem.php?pid=1520 1 #include 2 #include 3 #include 4 #include 5 #define maxn 7000 6 using namespace std; 7 8 int dp[...
转载 2014-07-22 08:41:00
43阅读
2评论
#include <iostream>using namespace std;int cnt[20], len[50];int cake_side, npiece;bool dfs(int used) //从上往下放,每次放在被覆盖最少的列上。{ if(used == npiece) return true; int min = 100, ind; for(int i = 0; i < cake_side; i++) //i=0表示第一列 { if(len[i]<min) { min = len[i]; ind = i; } } for(int i = 1; i &lt
转载 2011-07-20 22:31:00
50阅读
2评论
http://acm.hdu.edu.cn/showproblem.php?pid=1520 题意: 将有一个党庆祝乌拉尔国立大学80周年。大学有一个员工的层次结构。这意味着监督关系形成了一个树根源于校长VE Tretyakov。为了使党对每个人都有趣,主任不想让一个雇员和他或她的直接主管在场。人事
转载 2017-02-11 19:29:00
11阅读
1157 Anniversary(25 分)Zhejiang University is about to celebrate her 122th anniversary in 2019. To prepare f
原创 2022-09-15 10:52:47
56阅读
点击打开链接第一道树形dp题目 虽然a了 但理解还是不到位补
原创 2022-06-15 21:42:42
68阅读
There is going to be a party to celebrate the 80-th Anniversary of the Ural State University、
原创 2022-08-10 14:13:53
46阅读
Problem DescriptionThere is going to be a party to celebrate the 80-th Annivers
原创 2022-11-09 18:34:08
36阅读
题意:每个节点有权值,子节点和父节点不能同时选,问最后能选的最大价值是多少思路:树形DP入门,由于子节点和父节点不能同时选,那么决策其实就一目了然,对于第i个结点,选还是不选。dp[i][0]为不选取第i个结点时候的最大价值,dp[i][1]为选第i结点的最大价值,那么dp[i][0]+=max(dp[j][1],dp[j][0]),不选第i个结点的时候意味着你可能选了j结点,或者j结点也不选,d
原创 2023-06-09 18:15:20
39阅读
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 tr...
原创 2021-07-09 15:39:02
77阅读
没有上司的舞会 树形dp 屠龙宝刀点击就送
原创 2021-07-28 09:48:35
71阅读
    由于上司的关系构成了一颗树,于是我们可以从树形dp的角度去考虑问题。不妨用f[cur][0]表示不选当前节点时这棵子树value的最大值,f[cur][1]表示选当前节点时这棵子树value的最大值,那么如果不选当前节点,它的子节点就可选也可不选,因此f[cur][0]要加上所有子节点x的Max{f[x][1],f[x][0]},而如果选当前节点,它的子节点必然不能选,因此f[cur][1
转载 2012-05-04 14:02:00
47阅读
2评论
【题目链接】 点击打开链接 【算法】 树形DP 令f[i][0]表示 : 以i为根的子树中,若i不参加宴会,所能获得的最大愉悦值 f[i][1]表示 : 以i为根的子树中,若i参加宴会,所能获得的最大愉悦值 那么,如果i不参加宴会,它的下属就可以参加宴会,也可以不参加宴会,因此 : f[i][0]
转载 2018-05-15 20:44:00
53阅读
2评论
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
转载 2018-05-19 19:42:00
28阅读
There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical struct...
原创 2021-09-02 16:24:10
80阅读
Anniversary party HDU - 1520 题意:你要举行一个晚会,所有人的关系可以构成一棵树,要求上下级关系的人不能同时出现,每一个人都有一个rating值,要求使整个晚会的rating值最大。 /* 解题思路:树形dp,随意从一个点开始扩展,把周围所有节点的dp都解决出来,然后加上
转载 2017-09-15 17:35:00
24阅读
2评论
搜索 花式DFS
转载 2016-08-21 22:28:00
42阅读
2评论
Problem DescriptionThere is going to be a party to celebrate the 80-th Anniversary of the Ura
原创 2023-04-24 07:41:58
47阅读
  • 1
  • 2
  • 3
  • 4
  • 5