HDU 1423 Greatest Common Increasing Subsequence(最长公共上升LCIS) http://acm.hdu.edu.cn/showproblem.php?pid=1423 题意: 给你两个数字组成的串a和b,要你求出它们的最长公共严格递增子序列的长度(LCIS). 分析: 首先我们令f[i][j]==x表示是a串的前i个字符与b串的前j个字符构成的且以b[j]结尾的LCIS长度. 当a[i]!=b[j]时:        f[i][j]=f[i-1][j…
Greatest Common Increasing Subsequence 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1432 题目大意:给出两串数字,求他们的最长公共上升子序列(LCIS),并且打印出来. Sample Input 1 51 4 2 5 -124-12 1 2 4 Sample Output 21 4 分析:神奇就神奇在是LIS与LCS的组合 令dp[i][j]表示A串的前i个,与B串的前j…
传送门 $Description$ 求两个序列的最长公共上升子序列 $Solution$ $f[i][j]$表示$a$序列匹配到$i$和$b$序列匹配到$j$的最长上升序列的长度,这里并不要求$a[i]==b[j]$. 两层循环,外层$i=1...n1$,内层$j=1...n2$ 转移: $f[i][j]=max(f[i-1][1...j-1](if\  b[j]<a[i]))+1$ 这里的$max(f[i-1][i...j-1](if\  b[j]<a[i]))$不用每次单独枚举,只要在循环…
题目传送门 题意:LCIS(Longest Common Increasing Subsequence) 最长公共上升子序列 分析:a[i] != b[j]: dp[i][j] = dp[i-1][j]; a[i]==b[j]:  dp[j]=max(dp[j],dp[k]); (1<=k<j&&b[k]<b[j]) 打印路径时按照b[i]来输出 收获:理解不是很深入,推荐资料: 最长公共上升子序列(LCIS)的O(n^2)算法 最长公共上升子序列的另一个O(mn)的算法…
HDOJ 1423 Greatest Common Increasing Subsequence [DP][最长公共上升子序列] Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8768 Accepted Submission(s): 2831 Problem Description This is a problem from ZOJ 24…
Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5444    Accepted Submission(s): 1755 Problem Description This is a problem from ZOJ 2432.To make it easyer,…
\(Greatest Common Increasing Subsequence\) 大致题意:给出两个长度不一定相等的数列,求其中最长的公共的且单调递增的子序列(需要具体方案) \(solution:\) 这道题如果不看具体方案,且我们要求的子序列不存在相同的元素,那么我们可以用 \(cdq\) 分治来搞搞,首先我们记录第二个数列中的元素在第一个数列里出现的位置(假设不存在重复,没有的不管),然后我们的第二个数列的每一个元素就有两个权值了,这是我们只需要两个权值均单调递增即可(这是 $cdq…
题目链接: 题目 Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) 问题描述 This is a problem from ZOJ 2432.To make it easyer,you just need output the length of the subsequence. 输入 Each sequen…
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1423 Problem Description This is a problem from ZOJ 2432.To make it easyer,you just need output the length of the subsequence.   Input Each sequence is described with M - its length (1 <= M <= 500) and…
Problem Description This is a problem from ZOJ 2432.To make it easyer,you just need output the length of the subsequence.   Input Each sequence is described with M - its length (1 <= M <= 500) and M integer numbers Ai (-2^31 <= Ai < 2^31) - th…