
树形dp
永夜莫明
菜是原罪
展开
-
Ehab and a component choosing problem(树形dp)
https://cn.vjudge.net/problem/CodeForces-1088EYou're given a tree consisting ofnnnodes. Every nodeuuhas a weightauau. You want to choose an integerkk(1≤k≤n)(1≤k≤n)and then choosekkconnecte...原创 2019-08-18 16:56:48 · 168 阅读 · 0 评论 -
Y(树形dp)
https://cn.vjudge.net/problem/HDU-4705Input41 21 31 4Output1 Hint1. The only set is {2,3,4}. 2. Please use #pragma comment(linker, "/STACK:16777216")Sample Input4...原创 2019-08-18 15:07:54 · 145 阅读 · 0 评论 -
Acesrc and Travel(树上博弈dp)
http://acm.hdu.edu.cn/showproblem.php?pid=6662题目描述Acesrc is a famous tourist at Nanjing University second to none. During this summer holiday, he, along with Zhang and Liu, is going to travel t...原创 2019-08-16 22:57:16 · 431 阅读 · 0 评论 -
HDU6613 Squrirrel (树形dp)
https://cn.vjudge.net/contest/312854#problem/GMaster magician `eom` is searching for his naughty squirrel. The squirrel hides at a node of a tree, while its owner `eom` has no idea which node it hid...原创 2019-08-15 01:15:44 · 345 阅读 · 0 评论 -
Power Station (树形dp)
https://cn.vjudge.net/contest/312854#problem/JThe massive tsunami that struck the coastal city has washed away many ofinhabitants and facilities there. After the tsunami, the power supply facil...原创 2019-08-14 21:27:14 · 368 阅读 · 0 评论 -
Game(树形dp/找权值最大的前k条链)
https://cn.vjudge.net/contest/312854#problem/FIt is well known that Keima Katsuragi is The Capturing God because of his exceptional skills and experience in ''capturing'' virtual girls in gal games...原创 2019-08-13 20:40:40 · 373 阅读 · 0 评论 -
The Fair Nut and the Best Path
The Fair Nut and the Best Pathhttps://cn.vjudge.net/contest/312853#problem/HThe Fair Nut is going to travel to the Tree Country, in which there arenncities. Most of the land of this country is ...原创 2019-08-11 22:49:44 · 224 阅读 · 1 评论 -
Tree Cutting (Easy Version) (树形dp水题)
https://cn.vjudge.net/contest/312853#problem/IYou are given an undirected tree ofnnvertices.Some vertices are colored blue, some are colored red and some are uncolored. It is guaranteed that the...原创 2019-08-11 20:17:42 · 296 阅读 · 0 评论 -
New Year Santa Network(树形dp,期望,贡献,好题)
https://cn.vjudge.net/contest/312853#problem/FNew Year is coming in Tree World! In this world, as the name implies, there arencities connected byn - 1roads, and for any two distinct cities there ...原创 2019-08-11 19:09:49 · 209 阅读 · 0 评论 -
Fire(依赖型树形dp)
https://cn.vjudge.net/problem/POJ-2152Country 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 cities. Recently cou...原创 2019-08-02 01:26:02 · 276 阅读 · 0 评论 -
Tree(树形dp,树分治入门)
https://cn.vjudge.net/problem/POJ-1741Give a tree with n vertices,each edge has a length(positive integer less than 1001).Define dist(u,v)=The min distance between node u and v.Give an integer k,...转载 2019-07-30 19:58:01 · 607 阅读 · 0 评论 -
Computer(树形dp,求每个点在树上所能到的最远距离)
https://cn.vjudge.net/problem/HDU-2196A 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...原创 2019-07-28 02:08:11 · 220 阅读 · 0 评论 -
树形dp入门
https://www.cnblogs.com/seaupnice/p/9471700.html转载 2019-07-28 00:59:35 · 105 阅读 · 0 评论 -
meeting(类似树的直径问题,两次bfs或树形dp)
链接:https://ac.nowcoder.com/acm/contest/884/A来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述A new city has just been built. There'rennninteresting places...原创 2019-07-27 20:11:48 · 178 阅读 · 0 评论 -
滑稽树下你和我(树+贡献)
链接:https://ac.nowcoder.com/acm/contest/992/J?&headNav=acm来源:牛客网题目描述红红和蓝蓝是随机降生在苹果树上的苹果仙灵,现在红线仙想估测他们的CP系数,并决定是否使他们成为一对CP。给出n个结点n-1条边的树,节点编号为1到n,定义distance(i,j)为i与j的树上距离。CP系数是指所有红红和蓝蓝在不同位置i,j的d...原创 2019-07-14 20:48:44 · 351 阅读 · 0 评论 -
Rinne Loves Edges(树形dp)
题目链接:https://ac.nowcoder.com/acm/contest/370/F时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 131072K,其他语言262144K64bit IO Format: %lld题目描述Rinne 最近了解了如何快速维护可支持插入边删除边的图,并且高效的回答一下奇妙的询问。她现在拿到了一个 n 个节点 m 条边的无向连...原创 2019-03-03 20:37:35 · 288 阅读 · 0 评论 -
POJ1463 Strategic game 树形dp
http://poj.org/problem?id=1463Bob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is very sad. Now he has the following p...原创 2019-01-18 00:12:29 · 172 阅读 · 0 评论 -
POJ2342 Anniversary party 树形dp
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...原创 2019-01-17 20:03:49 · 166 阅读 · 0 评论