
算法-树形dp
文章平均质量分 81
醉语梦
“These are the night that never die”
展开
-
[codeforces 219D] Choosing Capital for Treeland (树形dp)
The country Treeland consists of n cities, some pairs of them are connected with unidirectional roads. Overall there are n - 1 roads in the country. We know that if we don’t take the direction of the ...原创 2018-03-18 23:51:26 · 394 阅读 · 1 评论 -
[poj 2152] fire (树形dp)
Time Limit: 2000MS Memory Limit: 65536K Description Country Z has N cities, which are numbered from 1 to N. Cities are connected by highways, and there is exact one path between two different c...原创 2018-03-23 01:36:20 · 267 阅读 · 0 评论 -
[luogu P1352] 没有上司的舞会 (树形dp)
日常来道水题233 题目描述 某大学有N个职员,编号为1~N。他们之间有从属关系,也就是说他们的关系就像一棵以校长为根的树,父结点就是子结点的直接上司。现在有个周年庆宴会,宴会每邀请来一个职员都会增加一定的快乐指数Ri,但是呢,如果某个职员的上司来参加舞会了,那么这个职员就无论如何也不肯来参加舞会了。所以,请你编程计算,邀请哪些职员可以使快乐指数最大,求最大的快乐指数。 输入输出格式 输入...原创 2018-04-19 16:42:36 · 143 阅读 · 0 评论