
DP
文章平均质量分 83
i-unique
擅长各种姿势划水
展开
-
POJ 2738 Two Ends(记忆化搜索+dp)
In the two-player game "Two Ends", an even number of cards is laid out in a row. On each card, face up, is written a positive integer. Players take turns removing a card from either end of the row and placing the card in their pile. The player whose cards原创 2017-08-10 21:04:12 · 436 阅读 · 0 评论 -
HDU 5532 Almost Sorted Array(最长不下降子序列nlogn模板)
We are all familiar with sorting algorithms: quick sort, merge sort, heap sort, insertion sort, selection sort, bubble sort, etc. But sometimes it is an overkill to use these algorithms for an almost sorted array. We say an array is sorted if its element原创 2017-09-21 20:28:27 · 367 阅读 · 0 评论 -
HDU 6197 array array array(最长不下降子序列)
One day, Kaitou Kiddo had stolen a priceless diamond ring. But detective Conan blocked Kiddo's path to escape from the museum. But Kiddo didn't want to give it back. So, Kiddo asked Conan a question. If Conan could give a right answer, Kiddo would return t原创 2017-09-10 17:43:20 · 355 阅读 · 0 评论 -
2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 L. The Heaviest Non-decreasing Subsequence Problem(最长不下降子序列变形)
Let SS be a sequence of integers s_{1}s1 , s_{2}s2 , ......, s_{n}sn Each integer is is associated with a weight by the following rules:(1) If is is negative, then its weight is 00.(2) If is is greater than or equal to 1000010000, then原创 2017-09-24 16:59:56 · 737 阅读 · 0 评论 -
模板总结
属于自己的模板。。。比赛防忘记赛前复习向原创 2017-07-24 10:25:30 · 1561 阅读 · 1 评论 -
CodeForces 314 B.Sereja and Periods 思维+简单dp【转】
Let's introduce the designation , where x is a string, n is a positive integer and operation " + " is the string concatenation operation. For example, [abc, 2] = abcabc.We'll say that string scan be obtained from string t, if we can remove some characters转载 2017-07-05 16:57:30 · 363 阅读 · 0 评论 -
WUST 1904 饥饿的牛(dp)
牛在饲料槽前排好了队。饲料槽依次用1到N(1<=N<=2000)编号。每天晚上,一头幸运的牛根据约翰的规则,吃其中一些槽里的饲料。约翰提供B个区间的清单。一个区间是一对整数start-end,1<=start<=end<=N,表示一些连续的饲料槽,比如1-3,7-8,3-4等等。牛可以任意选择区间,但是牛选择的区间不能有重叠。当然,牛希望自己能够吃得越多越好。给出一些区间,帮助这只牛找一些区间,使它能吃到最多的东西。在上面的例子中,1-3和3-4是重叠的;聪明的牛选择{1-3,7-8},这样可以吃到5原创 2017-07-06 23:38:23 · 869 阅读 · 0 评论 -
WUST 1906 演讲大厅安排,饥饿的牛(dp+线段覆盖经典)
有一个演讲大厅需要我们管理,演讲者们事先定好了需要演讲的起始时间和中止时间。我们想让演讲大厅得到最大可能的使用。我们要接受一些预定而拒绝其他的预定,目标是使演讲者使用大厅的时间最长。假设在某一时刻一个演讲结束,另一个演讲就可以立即开始。需要计算演讲大厅最大可能的使用时间。原创 2017-07-09 12:53:22 · 634 阅读 · 0 评论 -
HDU 2063 Investment (完全背包+数据压缩)
John never knew he had a grand-uncle, until he received the notary’s letter. He learned that his late grand-uncle had gathered a lot of money, somewhere in South-America, and that John was the only inheritor. John did not need that much money for the mom原创 2017-07-11 18:32:41 · 451 阅读 · 0 评论 -
HDU 2845 Beans(dp+求两次最达不连续子序列和)
Bean-eating is an interesting game, everyone owns an M*N matrix, which is filled with different qualities beans. Meantime, there is only one bean in any 1*1 grid. Now you want to eat the beans and collect the qualities, but everyone must obey by the follow原创 2017-07-11 21:10:33 · 324 阅读 · 0 评论 -
POJ 3670 Eating Together(dp)
The cows are so very silly about their dinner partners. They have organized themselves into three groups (conveniently numbered 1, 2, and 3) that insist upon dining together. The trouble starts when they line up at the barn to enter the feeding area.Each原创 2017-07-23 21:59:27 · 325 阅读 · 0 评论 -
WUST 1888 乘积最大(dp)
今年是国际数学联盟确定的“2000——世界数学年”,又恰逢我国著名数学家华罗庚先生诞辰90周年。在华罗庚先生的家乡江苏金坛,组织了一场别开生面的数学智力竞赛的活动,你的一个好朋友XZ也有幸得以参加。活动中,主持人给所有参加活动的选手出了这样一道题目: 设有一个长度为N的数字串,要求选手使用K个乘号将它分成K+1个部分,找出一种分法,使得这K+1个部分的乘积最大。 同时,为了帮助选手能够正确理解题意,主持人还举了如下的一个例子: 有一个数字串:312, 当N=3,K=1时会有以下两种分原创 2017-07-24 11:39:22 · 391 阅读 · 0 评论 -
POJ 3356 AGTC(dp之公共最长子序列)
Let x and y be two strings over some finite alphabet A. We would like to transform xinto y allowing only operations given below:Deletion: a letter in x is missing in y at a corresponding position.Insertion: a letter in y is missing in x at a correspondin原创 2017-07-25 16:50:07 · 411 阅读 · 0 评论 -
CodeForces 191A Dynasty Puzzles(DP)
The ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berla原创 2018-01-02 22:24:18 · 348 阅读 · 0 评论