
树形dp
Amo-
某弱校 垃圾 ,,
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Educational Codeforces Round 58 (Rated for Div. 2) D. GCD Counting
D. GCD Counting time limit per test 4.5 seconds memory limit per test 256 megabytes input standard input output standard output You are given a tree consisting of nn vertices. A number is wri...原创 2019-01-16 19:04:48 · 342 阅读 · 0 评论 -
Codeforces Round #551 (Div. 2) D. Serval and Rooted Tree (思维 + dp)
传送门:https://codeforces.com/contest/1153/problem/D D. Serval and Rooted Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Now ...原创 2019-04-16 16:52:35 · 291 阅读 · 0 评论 -
2018年 ICPC四川省省赛 I题 2812: Island (水题)
2812:Island Time Limit:1000 MSMemory Limit:1048576 KB Total Submit:91Accepted:17Page View:161SubmitStatusDiscuss Description Rinne dreads sunlight, so she wants to find a refuge with t...原创 2019-04-12 09:25:18 · 487 阅读 · 0 评论 -
洛谷 P1364 医院设置
题目描述 设有一棵二叉树,如图: 其中,圈中的数字表示结点中居民的人口。圈边上数字表示结点编号,现在要求在某个结点上建立一个医院,使所有居民所走的路程之和为最小,同时约定,相邻接点之间的距离为1。如上图中, 若医院建在1 处,则距离和=4+12+2*20+2*40=136;若医院建在3 处,则距离和=4*2+13+20+40=81…… 输入输出格式 输入格式: 第一行一个整数...原创 2019-04-12 00:37:44 · 272 阅读 · 0 评论 -
hdu 1561 The more, The Better(树形依赖背包)
The more, The Better Time Limit: 6000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10384Accepted Submission(s): 6042 Problem Description ACboy很喜欢玩一种...原创 2019-04-04 09:07:37 · 192 阅读 · 0 评论 -
codeforces 212E VK Cup 2012 Finals (unofficial online-version) E
E. IT Restaurants time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Сity N. has a huge problem with roads, food and IT-infrastruc...原创 2019-03-19 14:04:52 · 301 阅读 · 0 评论 -
codeforces 1056 D. Decorate Apple Tree (简单dfs)
D. Decorate Apple Tree time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There is one apple tree in Arkady's garden. It can be repre...原创 2019-03-13 18:05:03 · 463 阅读 · 0 评论 -
codeforces 219D - Choosing Capital for Treeland (树形dp)
D. Choosing Capital for Treeland time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output The country Treeland consists ofncities, some ...原创 2019-03-13 14:36:04 · 253 阅读 · 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 · 140 阅读 · 0 评论 -
Codeforces Round #428 (Div. 2) C. Journey
C. Journey time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There arencities andn - 1roads in the Seven Kingdoms, each road co...原创 2019-03-14 01:28:12 · 193 阅读 · 0 评论 -
Codeforces Round #395 (Div. 2) C. Timofey and a tree
最后再补个简单的树上dfs吧 C. Timofey and a tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Each New Year Timofey and his friends cut ...原创 2019-03-14 01:24:42 · 150 阅读 · 0 评论 -
VK Cup 2012 Round 1 codeforces 161D. Distance in Tree
D. Distance in Tree time limit per test 3 seconds memory limit per test 512 megabytes input standard input output standard output Atreeis a connected graph that doesn't contain any cycles. ...原创 2019-03-14 01:21:17 · 206 阅读 · 0 评论 -
Codeforces Round #484 (Div. 2) C. Cut 'em all!(简单树形dp)
C. Cut 'em all! time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You're given a tree withnnvertices. Your task is to determine t...原创 2019-03-14 00:50:59 · 198 阅读 · 0 评论 -
Codeforces Round #540 (Div. 3) F1 Tree Cutting (Easy Version) 1118F1 (裸的树上dfs,树形dp)
传送门:https://codeforces.com/contest/1118/problem/F1 F1. Tree Cutting (Easy Version) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard outpu...原创 2019-02-21 23:42:18 · 344 阅读 · 0 评论 -
Codeforces Round #530 (Div. 2) 1099D D. Sum in the tree
D. Sum in the tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mitya has a rooted tree with nn vertices indexed from 11 to nn...原创 2019-01-16 20:00:21 · 432 阅读 · 0 评论 -
Average distance hdu 2376
Average distance Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1765 Accepted Submission(s): 647Special Judge Problem Description Give...原创 2019-01-16 19:20:44 · 288 阅读 · 0 评论 -
Codeforces Round #482 (Div. 2) C. Kuro and Walking Route / 979C
C. Kuro and Walking Route time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Kuro is living in a country called Uberland, consisting...原创 2019-01-16 19:14:15 · 832 阅读 · 0 评论 -
桂林电子科技大学第三届ACM程序设计竞赛(LCA、dp、树形dp、后缀数组、贪心)
链接:https://ac.nowcoder.com/acm/contest/558#question A:后缀数组模板题 B:map标记一下 C: 链接:https://ac.nowcoder.com/acm/contest/558/C 来源:牛客网 题目描述 小猫在研究二元组。 小猫在研究最大值。 给定N个二元组(a1,b1),(a2,b2),…,(aN,bN),请你从中选出恰...原创 2019-04-15 15:06:33 · 765 阅读 · 0 评论