随笔分类 - 各种dp 树形dp
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5568 Given a tree with n vertices, we want to add an edge between vertex 1 and vertex x, so
阅读全文
摘要:http://codeforces.com/contest/322/problem/E E. Ciel the Commander time limit per test 1 second memory limit per test 256 megabytes input standard inpu
阅读全文
摘要:http://codeforces.com/gym/100676/attachments 题目大意: 有n个城市,有m条路,每条路都有边长,如果某几个城市的路能组成一个环,那么在环中的这些城市就有传送门,能够瞬间抵达对方的城市(即距离为0),否则,就要走这条路,并且经过的路程为这条路的长度。 问,找
阅读全文
摘要:①树的重心的性质的运用 ②缩点以后寻找规律 树的直径! ③树形dp上的公式转换 ④和期望有关的树形dp + 一点排列组合的知识 ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ 一:Codeforces Round #364 (Div. 1) B http://codeforces.com/problemset/proble
阅读全文
摘要:http://codeforces.com/problemset/problem/700/B 题目大意:给你一棵树,给你k个树上的点对。找到k/2个点对,使它在树上的距离最远。问,最大距离是多少? 思路:我们可以把树上的这个分成两个集合,然后两边的点的数目相等。符合这个条件的就是树的重心,所以我们只
阅读全文

浙公网安备 33010602011771号