随笔分类 -  动态规划—树形dp

摘要:非常nice的题目 阅读全文
posted @ 2020-03-27 17:54 天之道,利而不害 阅读(206) 评论(0) 推荐(0)
摘要:title: A Knapsack Problem date: 2018 11 08 00:07:00 tags: Algorithm mathjax: true 题意 $n(1 \leq n \leq 1000)$个结点的树,每个结点有重量$w$和价值$v$两个属性,现在给你一个大小为$m(1 \ 阅读全文
posted @ 2018-11-09 22:17 天之道,利而不害 阅读(267) 评论(0) 推荐(0)
摘要:Problem Description In the battlefield , an effective way to defeat enemies is to break their communication system.The information department told you 阅读全文
posted @ 2017-11-01 23:40 天之道,利而不害 阅读(296) 评论(0) 推荐(0)
摘要:The country Treeland consists of n cities, some pairs of them are connected with unidirectional roads. Overall there are n - 1 roads in the country. W 阅读全文
posted @ 2017-11-01 13:10 天之道,利而不害 阅读(408) 评论(0) 推荐(0)
摘要:You, the leader of Starship Troopers, are sent to destroy a base of the bugs. The base is built underground. It is actually a huge cavern, which consi 阅读全文
posted @ 2017-10-31 18:21 天之道,利而不害 阅读(240) 评论(0) 推荐(0)
摘要:In the new ACM-ICPC Regional Contest, a special monitoring and submitting system will be set up, and students will be able to compete at their own uni 阅读全文
posted @ 2017-10-29 00:23 天之道,利而不害 阅读(225) 评论(0) 推荐(0)
摘要:After Farmer John realized that Bessie had installed a "tree-shaped" network among his N (1 <= N <= 10,000) barns at an incredible cost, he sued Bessi 阅读全文
posted @ 2017-10-28 23:19 天之道,利而不害 阅读(279) 评论(0) 推荐(0)
摘要:Last years Chicago was full of gangster fights and strange murders. The chief of the police got really tired of all these crimes, and decided to arres 阅读全文
posted @ 2017-10-28 23:11 天之道,利而不害 阅读(249) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2017-10-28 22:06 天之道,利而不害 阅读(167) 评论(0) 推荐(0)
摘要: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 co 阅读全文
posted @ 2017-10-28 22:02 天之道,利而不害 阅读(247) 评论(0) 推荐(0)
摘要:After hearing about the epidemic of obesity in the USA, Farmer John wants his cows to get more exercise, so he has committed to create a bovine marath 阅读全文
posted @ 2017-10-28 21:55 天之道,利而不害 阅读(213) 评论(0) 推荐(0)
摘要:Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements numbered from 1 to n. Moving through the 阅读全文
posted @ 2017-10-27 12:03 天之道,利而不害 阅读(450) 评论(0) 推荐(0)
摘要:As you know, an undirected connected graph with n nodes and n - 1 edges is called a tree. You are given an integer d and a tree consisting of n nodes. 阅读全文
posted @ 2017-10-26 15:44 天之道,利而不害 阅读(348) 评论(0) 推荐(0)
摘要:树的最大独立集:对于一颗n个结点的无根树,选出尽量多的结点,使得任何两个结点都不相邻。 题解:dp[ i ][ 0 ~ 1 ]表示以 i 为根结点的子树的最大独立集,0表示不选 i ,1表示选 i 。记 i 的儿子为son。 选 i 的话,其儿子可选可不选,即dp[ i ][ 1 ]+=min(dp 阅读全文
posted @ 2017-09-05 17:15 天之道,利而不害 阅读(168) 评论(0) 推荐(0)