
动态规划树形dp
Mannix_Y
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
树的独立集
int dfs(int u, int fa){ ULL sz = ve[u].size(); for(int i=0; i<sz; i++) { int v = ve[u][i]; if(v != fa) dfs(v, u); s[u] += dp[v]; if(fa != -1) gs[fa] += dp[v...原创 2018-12-04 11:47:47 · 425 阅读 · 0 评论 -
Perfect Service (最小支配集)
A network is composed of N computers connected by N − 1 communication links such that any two computers can be communicated via a unique route. Two computers are said to be adjacent if there is a comm...原创 2018-12-05 11:50:40 · 444 阅读 · 0 评论 -
Party at Hali-Bula (最大独立集)
Dear Contestant, I’m going to have a party at my villa at Hali-Bula to celebrate my retirement from BCM. I wish I could invite all my co-workers, but imagine how an employee can enjoy a party when he...原创 2018-12-05 12:43:27 · 346 阅读 · 0 评论 -
Balancing Act(树的重心)
Consider a tree T with N (1 <= N <= 20,000) nodes numbered 1...N. Deleting any node from the tree yields a forest: a collection of one or more trees. Define the balance of a node to be the size ...原创 2018-12-16 15:42:24 · 402 阅读 · 0 评论 -
Computer(树形dp)
A school bought the first computer some time ago(so this computer's id is 1). During the recent years the school bought N-1 new computers. Each new computer was connected to one of settled earlier. Ma...原创 2019-01-11 11:40:37 · 262 阅读 · 0 评论 -
Apple Tree(树状dp)
Wshxzt is a lovely girl. She likes apple very much. One day HX takes her to an apple tree. There are N nodes in the tree. Each node has an amount of apples. Wshxzt starts her happy trip at one node. S...原创 2019-01-11 16:21:02 · 435 阅读 · 0 评论 -
[国家集训队]聪聪可可(树形dp)
题目描述 聪聪和可可是兄弟俩,他们俩经常为了一些琐事打起来,例如家中只剩下最后一根冰棍而两人都想吃、两个人都想玩儿电脑(可是他们家只有一台电脑)……遇到这种问题,一般情况下石头剪刀布就好了,可是他们已经玩儿腻了这种低智商的游戏。 他们的爸爸快被他们的争吵烦死了,所以他发明了一个新游戏:由爸爸在纸上画n个“点”,并用n-1条“边”把这n个“点”恰好连通(其实这就是一棵树)。并且每条“边”上都有一...原创 2019-06-19 21:29:07 · 298 阅读 · 0 评论 -
E. Tree Painting (树形dp)
E. Tree Painting time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a tree (an undirected connected acyclic graph) con...原创 2019-07-19 10:28:30 · 313 阅读 · 0 评论