题意:给定一个长度为N的数组,求两个连续的子序列,使得两个连续子序列的和最大。
分析:乍一看,跟最大连续和有点类似,但是,又有区别,因为对于这个题,考虑第i项两个连续子序列的最大和,不能仅仅由前i-1项递推得出,第i项两个连续子序列的最大和,与前i项和i以后的之间是存在关系的,因此这个题目是一个双向dp。
假如给定的序列为a0, a1, a2, a3, a4, ...... ,an,那么,对于...
分类:
其他好文 时间:
2015-07-26 11:15:59
阅读次数:
144
RMQ (Range Minimum/Maximum Query)问题是指:对于长度为n的数列A,回答若干询问RMQ(A,i,j)(i,j<=n),返回数列A中下标在i,j里的最小(大)值,也就是说,RMQ问题是指求区间最值的问题。...
分类:
其他好文 时间:
2015-07-25 21:37:41
阅读次数:
125
B - Common Subsequence
Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d
& %I64u
Submit Status Practice POJ
1458
Description
A subsequence of a given sequence is...
分类:
其他好文 时间:
2015-07-25 20:04:09
阅读次数:
187
A - Maximum sum
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d
& %I64u
Submit Status Practice POJ
2479
Description
Given a set of n integers: A={a1, a2,..., a...
分类:
其他好文 时间:
2015-07-25 18:29:19
阅读次数:
165
// hdu3530 Subsequence 单调队列
// 题目大意:找到一个最大的子串,使得子串区间内最大值和最小值的差
// 在low和up范围内,串的规模10w。
// 解题思路:
// 单调队列,单调队列可以保留i位置之前的最大值和最小值的下标,有了这些
// 则,每次我们比较两个队列的队头,看差值是否大于up,(因为它是到i位置最大
// ...
分类:
其他好文 时间:
2015-07-25 16:53:45
阅读次数:
144
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2015-07-24 20:41:53
阅读次数:
82
题目:
Given a string S and a string T, count the number of distinct subsequences of T in S.
A subsequence of a string is a new string which is formed from the original string by deleting some (c...
分类:
编程语言 时间:
2015-07-24 13:00:46
阅读次数:
238
I love developing software on my MacBook Air! I got the latest version with the maximum possible specifications (i7, 8GB internal mem, 512GBSSD disk) ...
分类:
系统相关 时间:
2015-07-24 12:31:18
阅读次数:
221
题目https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/
Say you have an array for which the ith element is the price of a
given stock on day i. Design an algorithm to find the maximum...
分类:
其他好文 时间:
2015-07-24 09:22:28
阅读次数:
125
Common SubsequenceProblem DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out....
分类:
其他好文 时间:
2015-07-23 17:39:32
阅读次数:
111