![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划
文章平均质量分 95
Dust_Heart
这个作者很懒,什么都没留下…
展开
-
Codeforces 1324F - Maximum White Subtree 【树形DP】
Maximum White SubtreeTime Limit: 2000 MS Memory Limit: 256MB Problem DescriptionYou are given a tree consisting of nn vertices. A tree is a connected undirected graph with n−1 edges. Each vertex...原创 2020-03-13 12:01:05 · 543 阅读 · 0 评论 -
2017 ACM/ICPC 广西邀请赛||HDU 6185 Covering 【状压DP+矩阵快速幂】
2017 ACM/ICPC 广西邀请赛||HDU 6185 Covering 【状压DP+矩阵快速幂】Bob's school has a big playground, boys and girls always play games here afterschool.To protect boys and girls from getting hurt when playing happily on theplayground, rich boy Bob decided to cover the原创 2017-08-31 17:26:45 · 2194 阅读 · 4 评论 -
HDU 6201 transaction transaction transaction【树形DP||SPFA最长路】
transactiontransaction transactionTime Limit: 4000/2000 MS(Java/Others)Memory Limit: 132768/132768 K(Java/Others)Total Submission(s): 38Accepted Submission(s): 21Problem Description...原创 2017-09-10 18:45:25 · 1476 阅读 · 0 评论 -
2017 Multi-University Training Contest 10 && HDU 6178 Monkeys 【贪心||树形DP】
2017 Multi-University Training Contest 10 && HDU 6178 Monkeys 【贪心||树形DP】 There is a tree having N vertices. In the tree there are K monkeys (K <= N). A vertex can be occupied by at most one monkey. They want to remove some edges and leave minimum edges, b原创 2017-08-25 21:01:46 · 449 阅读 · 0 评论 -
区间DP小结(附经典例题)
——这篇文章主要想总结下区间DP的经典题目,同时给自己复习巩固这方面知识点。区间DP一、定义区间DP,顾名思义是在区间上DP,它的主要思想就是先在小区间进行DP得到最优解,然后再利用小区间的最优解合并求大区间的最优解。二、实现思路下面给出区间DP最简单形式的伪代码(具体要根据题目修改)//mst(dp,0) 初始化DP数组for......原创 2017-08-13 12:50:24 · 25183 阅读 · 1 评论 -
Codeforces 837D - Round Subset 【DP】
Codeforces 837D - Round Subset 【DP】 Let's call the roundness of the number the number of zeros to which it ends.You have an array of n numbers. You need to choose a subset of exactly k numbers so that the roundness of the product of the selected numbers原创 2017-08-04 02:16:34 · 1584 阅读 · 0 评论 -
Codeforces 835D - Palindromic characteristics 【区间DP+回文串】
Codeforces 835D - Palindromic characteristics 【区间DP+回文串】 Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number ofnon-empty substrings of s which are k-palindromes.A string is 1-palin原创 2017-08-02 11:07:59 · 557 阅读 · 0 评论 -
Codeforces 833B - The Bakery 【DP+线段树】
Codeforces 833B - The Bakery 【DP+线段树】 Some time ago Slastyona the Sweetmaid decided to open her own bakery! She bought required ingredients and a wonder-oven which can bake several types of cakes, and opened the bakery.Soon the expenses started to overco原创 2017-07-31 15:31:38 · 1701 阅读 · 0 评论 -
UESTC 1690 这是一道比CCCC简单题难的简单题||HiHoCoder #1048 : 状态压缩·二
UESTC 1690 这是一道比CCCC简单题难的简单题||HiHoCoder #1048 : 状态压缩·二给定一个n*m的矩阵,使用1*2的小长方形覆盖矩阵,要求完全覆盖的同时不出现重合,也不允许超出边界,问有多少种可能的覆盖方法,方案数对1e9+7取模历经千辛万苦,小Hi和小Ho终于到达了举办美食节的城市!虽然人山人海,但小Hi和小Ho仍然抑制不住兴奋之情,他们放下行李便投入到了美食节的活动当中。美食节的各个摊位上各自有着非常多的有意思的小游戏,其中一个便是这样子的:小Hi和小Ho领到了一个大小为原创 2017-07-06 22:06:57 · 1002 阅读 · 0 评论 -
HDOJ 4539 郑厂长系列故事——排兵布阵(状压DP)
HDOJ 4539 郑厂长系列故事——排兵布阵(状压DP) 郑厂长不是正厂长 也不是副厂长 他根本就不是厂长 事实上 他是带兵打仗的团长 一天,郑厂长带着他的军队来到了一个n*m的平原准备布阵。 根据以往的战斗经验,每个士兵可以攻击到并且只能攻击到与之曼哈顿距离为2的位置以及士兵本身所在的位置。当然,一个士兵不能站在另外一个士兵所能攻击到的位置,同时因为地形的原因平原上也不是每一个位置都可以安排士兵。 现在,已知n,m 以及平原阵地的具体地形,请你帮助郑厂长计算该阵地,最多能原创 2020-10-18 10:30:27 · 373 阅读 · 0 评论 -
2018 Multi-University Training Contest 8&&HDU6406 Taotao Picks Apples【ST表&&LIS】
Taotao Picks Apples Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Problem DescriptionThere is an apple tree in front of Taotao’s house. When autumn comes, n...原创 2018-08-16 16:09:28 · 455 阅读 · 0 评论 -
2018 Multi-University Training Contest 3 &&HDU6331 Walking Plan【最短路DP】
Walking Plan Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Problem DescriptionThere are n intersections in Bytetown, connected with m one way streets. Lit...原创 2018-07-31 20:52:52 · 309 阅读 · 0 评论 -
HDU 5909 Tree Cutting 【树型DP】
HDU 5909 Tree Cutting 【树型DP】Byteasar has a tree T with n vertices conveniently labeledwith 1,2,...,n. Each vertex of the tree hasan integer value vi.The value of a non-empty tree T is equal to v1⊕v2⊕...⊕vn, where ⊕denotes bitwise-xor.Now for every integ原创 2018-04-18 16:08:30 · 254 阅读 · 0 评论 -
Codeforces 426C - Sereja and Swaps 【优先队列||DP】
Codeforces 426C - Sereja and Swaps 【优先队列||DP】Codeforces Round #243 (Div. 2)给定一个长度为 n 的序列 a1,an,...,an,你有 k 次机会选择 一个 x 和 y(1 ≤x < y≤n),交换 ax 和 ay。 k 次机会不一定要全部用完,你需要操作完之后选择一个区 间 [l,r] 使得 al +al+1 + ... +ar 最大。As usual, Sereja has array a, its elementsare原创 2018-03-27 16:27:39 · 333 阅读 · 0 评论 -
Codeforces 932D - Tree 【树上倍增】
Codeforces 932D - Tree 【树上倍增】You are given a node of the tree withindex 1 and with weight 0. Let cnt be the numberof nodes in the tree at any instant (initially, cnt is set to 1). Support Q queries offollowing two types:Add a new node (index cnt + 1) wi原创 2018-02-20 00:04:09 · 1054 阅读 · 2 评论 -
Codeforces 946D - Timetable 【动态规划】
Codeforces 946D - Timetable 【动态规划】Educational Codeforces Round 39 (Rated for Div. 2)Ivan is astudent at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classesat the university.There are m wo原创 2018-03-07 16:39:46 · 560 阅读 · 0 评论 -
常州大学新生寒假训练会试 D-训练技巧【动态规划】
常州大学新生寒假训练会试 D-训练技巧【动态规划】常州大学组织了新生寒假训练一共N天,每天训练可以获得的训练效果是Ei。但是如果连续训练超过K天,萌新们会受不了而被劝退。现在负责人想知道,如何安排能保证萌新不会被劝退并且能获得最大的训练效果。原创 2018-02-07 20:21:36 · 573 阅读 · 0 评论 -
Codeforces 919D - Substring 【有向图判环+DP】
Codeforces 919D - Substring 【有向图判环+DP】You are given agraph with n nodes and m directed edges. One lowercase letter is assigned to each node. We define a path'svalue as the number of the most frequently occurring letter. For example, ifletters on a path ar原创 2018-01-31 23:18:49 · 865 阅读 · 0 评论 -
HAUTOJ 1265 Hmz 的女装
HAUTOJ 1265 Hmz 的女装Hmz为了女装,想给自己做一个长度为n的花环。现在有k种花可以选取,且花环上相邻花的种类不能相同。Hmz想知道,如果他要求第l朵花和第r朵花颜色相同,做花环的方案数是多少。这个答案可能会很大,你只要输出答案对10^9+7取模的结果即可。原创 2017-07-08 21:08:33 · 437 阅读 · 0 评论 -
ACM有关子序列的DP题合集【plus: Codeforces 597C Subsequences】
ACM有关子序列的DP题合集题目一:HDOJ 1003 Max Sum题目二:HDOJ 1231 最大连续子序列题目三:HAUTOJ 1266 最大子段和题目四:UESTC OJ 1006 最大上升子序列题目五:HDOJ 2845 Beans题目六:HDOJ 2372 El DoradoCodeforces 597C Subsequences题目七:HDOJ 5586 Sum题目八:HDOJ 5791 Two原创 2017-07-07 15:22:20 · 1007 阅读 · 0 评论 -
HDOJ 3045 Picnic Cows(斜率优化DP)
Picnic CowsTime Limit: 8000/4000 MS(Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2880 Accepted Submission(s): 910Problem DescriptionIt’s summer vocation原创 2017-04-30 21:27:36 · 250 阅读 · 0 评论 -
HDOJ 2191 (多重背包/二进制分解/单调队列优化DP)
悼念512汶川大地震遇难同胞——珍惜现在,感恩生活Time Limit: 1000/1000 MS(Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 28982 Accepted Submission(s): 12110Problem Description急!灾原创 2017-04-29 23:46:08 · 455 阅读 · 0 评论 -
HDOJ 3401 Trade(单调队列优化DP)
TradeTime Limit: 2000/1000 MS(Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4793 Accepted Submission(s): 1617Problem DescriptionRecently, lxhgww is addic原创 2017-04-29 22:44:46 · 292 阅读 · 0 评论 -
CDOJ 我要长高 (单调队列优化DP)
我要长高Time Limit: 4000/2000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)韩父有N个儿子,分别是韩一,韩二…韩N。由于韩家演技功底深厚,加上他们间的密切配合,演出获得了巨大成功,票房甚至高达2000万。舟子是名很有威望的公知,可是他表面上两袖清风实则内心阴暗,看到韩家红红火火,嫉妒心遂原创 2017-04-29 20:35:12 · 443 阅读 · 0 评论 -
2016年第四届湘潭大学新生趣味程序设计竞赛 解题报告(动态规划)
Estrella's TravelAccepted : 106 Submit : 269Time Limit : 1000 MS Memory Limit : 65536 KB Estrella's Travel题目描述Estrella喜欢旅行,她准备去自己心仪的城市看风景。她精心选择了一条原创 2016-12-19 03:06:40 · 691 阅读 · 0 评论 -
HDOJ 2829 Lawrence(斜率优化DP)
LawrenceTime Limit: 2000/1000 MS(Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3979 Accepted Submission(s): 1804Problem DescriptionT. E. Lawrence was aco原创 2017-04-30 23:55:06 · 322 阅读 · 0 评论 -
HDOJ 3480 Division(斜率优化DP)
DivisionTime Limit: 10000/5000 MS(Java/Others) Memory Limit: 999999/400000 K(Java/Others)Total Submission(s): 4743 Accepted Submission(s): 1842Problem DescriptionLittle D is really i原创 2017-05-01 12:52:49 · 226 阅读 · 0 评论 -
HDOJ 5965 扫雷 【DP】
HDOJ 5965 扫雷 【DP】扫雷游戏是晨晨和小璐特别喜欢的智力游戏,她俩最近沉迷其中无法自拔。该游戏的界面是一个矩阵,矩阵中有些格子中有一个地雷,其余格子中没有地雷。 游戏中,格子可能处于己知和未知的状态。如果一个己知的格子中没有地雷,那么该 格子上会写有一个一位数,表示与这个格子八连通相邻的格子中地雷总的数量。现在,晨晨和小璐在一个3行N列(均从1开始用连续正整数编号)的矩阵中进 行游戏,在这个矩阵中,第2行的格子全部是己知的,并且其中均没有地雷;而另外 两行中是未知的,并且其中的地雷总数量也原创 2017-07-08 09:55:09 · 437 阅读 · 0 评论 -
2017 CCPC-WFinal&&HDOJ 6024 Building Shops
HDU’s n classrooms are on a line ,which can be considered as a number line.Each classroom has a coordinate. Now Little Q wants to build several candyshops in thesen classrooms.The total cost consists of two parts. Building a candy shop at classroom i wou原创 2017-05-07 14:49:50 · 893 阅读 · 0 评论 -
7.6 Virtual judge个人训练赛题解(为了拯救最近的迷之状态)
A. UESTC 1006 最长上升子序列B. UESTC 1271 Search goldC. UESTC 1606 难喝的饮料D. UESTC 1607 大学生足球联赛E. UESTC 1690 这是一道比CCCC简单题难的简单题F. UESTC 1691 这是一道比CCCC简单题经典的中档题G. UESTC 1692 这是一道比CCCC简单题更有想象力的中档题原创 2017-07-06 23:20:07 · 635 阅读 · 0 评论 -
CF Round #424( Div.2) D. Office Keys 【二分||DP】
CF Round #424( Div.2) D. Office Keys 【二分】There are n people and k keys on a straight line. Every person wants to get to theoffice which is located on the line as well. To do that, he needs to reach somepoint with a key, take the key and then go to the of原创 2017-07-14 02:17:40 · 795 阅读 · 0 评论 -
CF Round #413( Div.1/2) Field expansion
D. Field expansiontime limit per test 1 secondmemory limit per test 256 megabytesinput standard inputoutput standard outputIn one of the games Arkady is fond ofthe game process h原创 2017-05-12 15:17:10 · 507 阅读 · 0 评论 -
HZAU 网络赛 Little Red Riding Hood
1199: Little Red Riding HoodTime Limit: 1 Sec Memory Limit:1280 MBSubmit: 898 Solved: 149[Submit][Status][Web Board]Description Once upon a time, there was a little girl. Her原创 2017-04-26 14:17:57 · 319 阅读 · 0 评论 -
HDOJ 3507 Print Article (斜率优化DP)
Print ArticleTime Limit: 9000/3000 MS(Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 11840 Accepted Submission(s): 3617 Problem DescriptionZero has an old pr...原创 2017-04-30 17:30:53 · 707 阅读 · 0 评论 -
HDOJ 1024 Max Sum Plus Plus
Max Sum Plus PlusTimeLimit: 2000/1000 MS (Java/Others) Memory Limit:65536/32768 K (Java/Others)Total Submission(s): 28798 Accepted Submission(s): 10099Problem DescriptionNow I think原创 2017-05-24 19:40:53 · 341 阅读 · 0 评论