![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树形dp
Amo-
某弱校 垃圾 ,,
展开
-
Educational Codeforces Round 58 (Rated for Div. 2) D. GCD Counting
D. GCD Countingtime limit per test4.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a tree consisting of nn vertices. A number is wri...原创 2019-01-16 19:04:48 · 279 阅读 · 0 评论 -
Codeforces Round #551 (Div. 2) D. Serval and Rooted Tree (思维 + dp)
传送门:https://codeforces.com/contest/1153/problem/DD. Serval and Rooted Treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNow ...原创 2019-04-16 16:52:35 · 225 阅读 · 0 评论 -
2018年 ICPC四川省省赛 I题 2812: Island (水题)
2812:IslandTime Limit:1000 MSMemory Limit:1048576 KBTotal Submit:91Accepted:17Page View:161SubmitStatusDiscussDescriptionRinne dreads sunlight, so she wants to find a refuge with t...原创 2019-04-12 09:25:18 · 367 阅读 · 0 评论 -
洛谷 P1364 医院设置
题目描述设有一棵二叉树,如图:其中,圈中的数字表示结点中居民的人口。圈边上数字表示结点编号,现在要求在某个结点上建立一个医院,使所有居民所走的路程之和为最小,同时约定,相邻接点之间的距离为1。如上图中,若医院建在1 处,则距离和=4+12+2*20+2*40=136;若医院建在3 处,则距离和=4*2+13+20+40=81……输入输出格式输入格式:第一行一个整数...原创 2019-04-12 00:37:44 · 230 阅读 · 0 评论 -
hdu 1561 The more, The Better(树形依赖背包)
The more, The BetterTime Limit: 6000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10384Accepted Submission(s): 6042Problem DescriptionACboy很喜欢玩一种...原创 2019-04-04 09:07:37 · 156 阅读 · 0 评论 -
codeforces 212E VK Cup 2012 Finals (unofficial online-version) E
E. IT Restaurantstime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputСity N. has a huge problem with roads, food and IT-infrastruc...原创 2019-03-19 14:04:52 · 241 阅读 · 0 评论 -
codeforces 1056 D. Decorate Apple Tree (简单dfs)
D. Decorate Apple Treetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is one apple tree in Arkady's garden. It can be repre...原创 2019-03-13 18:05:03 · 398 阅读 · 0 评论 -
codeforces 219D - Choosing Capital for Treeland (树形dp)
D. Choosing Capital for Treelandtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe country Treeland consists ofncities, some ...原创 2019-03-13 14:36:04 · 205 阅读 · 0 评论 -
51nod 1405 树的距离之和 简单dp 2019/03/21
1405 树的距离之和1 秒 131,072 KB 40 分 4 级题给定一棵无根树,假设它有n个节点,节点编号从1到n, 求任意两点之间的距离(最短路径)之和。收起输入第一行包含一个正整数n (n <= 100000),表示节点个数。后面(n - 1)行,每行两个整数表示树的边。输出每行一个整数,第i(i = 1,2,...n)行表...原创 2019-03-21 14:36:43 · 107 阅读 · 0 评论 -
Codeforces Round #428 (Div. 2) C. Journey
C. Journeytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere arencities andn - 1roads in the Seven Kingdoms, each road co...原创 2019-03-14 01:28:12 · 121 阅读 · 0 评论 -
Codeforces Round #395 (Div. 2) C. Timofey and a tree
最后再补个简单的树上dfs吧C. Timofey and a treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputEach New Year Timofey and his friends cut ...原创 2019-03-14 01:24:42 · 117 阅读 · 0 评论 -
VK Cup 2012 Round 1 codeforces 161D. Distance in Tree
D. Distance in Treetime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputAtreeis a connected graph that doesn't contain any cycles....原创 2019-03-14 01:21:17 · 151 阅读 · 0 评论 -
Codeforces Round #484 (Div. 2) C. Cut 'em all!(简单树形dp)
C. Cut 'em all!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou're given a tree withnnvertices.Your task is to determine t...原创 2019-03-14 00:50:59 · 144 阅读 · 0 评论 -
Codeforces Round #540 (Div. 3) F1 Tree Cutting (Easy Version) 1118F1 (裸的树上dfs,树形dp)
传送门:https://codeforces.com/contest/1118/problem/F1F1. Tree Cutting (Easy Version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outpu...原创 2019-02-21 23:42:18 · 270 阅读 · 0 评论 -
Codeforces Round #530 (Div. 2) 1099D D. Sum in the tree
D. Sum in the treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMitya has a rooted tree with nn vertices indexed from 11 to nn...原创 2019-01-16 20:00:21 · 387 阅读 · 0 评论 -
Average distance hdu 2376
Average distanceTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1765 Accepted Submission(s): 647Special Judge Problem DescriptionGive...原创 2019-01-16 19:20:44 · 237 阅读 · 0 评论 -
Codeforces Round #482 (Div. 2) C. Kuro and Walking Route / 979C
C. Kuro and Walking Routetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKuro is living in a country called Uberland, consisting...原创 2019-01-16 19:14:15 · 541 阅读 · 0 评论 -
桂林电子科技大学第三届ACM程序设计竞赛(LCA、dp、树形dp、后缀数组、贪心)
链接:https://ac.nowcoder.com/acm/contest/558#questionA:后缀数组模板题B:map标记一下C:链接:https://ac.nowcoder.com/acm/contest/558/C来源:牛客网题目描述小猫在研究二元组。小猫在研究最大值。给定N个二元组(a1,b1),(a2,b2),…,(aN,bN),请你从中选出恰...原创 2019-04-15 15:06:33 · 697 阅读 · 0 评论