hdu5904 简单dp
来源:互联网 发布:淘宝绑定优酷怎么取消 编辑:程序博客网 时间:2024/06/03 19:15
http://acm.hdu.edu.cn/showproblem.php?pid=5904
求两个串最长公共递增子序列的长度,且递增的序列相差1,这就简单多了,只要求出两个序列以每一位为结尾的连续序列的长度
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>using namespace std;const int maxn=2e5+5;int a[maxn],b[maxn],dpa[maxn],dpb[maxn];int main(){ int t; int n,m; scanf("%d",&t); while(t--) { memset(dpa,0,sizeof(dpa)); memset(dpb,0,sizeof(dpb)); scanf("%d%d",&n,&m); for(int i=0; i<n; i++) { scanf("%d",&a[i]); dpa[a[i]]=dpa[a[i]-1]+1; } for(int i=0; i<m; i++) { scanf("%d",&b[i]); dpb[b[i]]=dpb[b[i]-1]+1; } int sum=0; for(int i=0; i<200005; i++) sum=max(sum,min(dpa[i],dpb[i])); printf("%d\n",sum); } return 0;}
0 0
- hdu5904 简单dp
- hdu5904 LCIS(dp)
- hdu5904 LCIS dp
- HDU5904 LCIS (DP)
- hdu5904
- hdu5904 BestCoder Round #87 LCIS -dp
- HDU5904【瞎搞】
- hdu5904 LCIS
- HDU5904-LCIS
- HDU5904 思路不错的dp....比我的蠢逼LCS强多了
- 简单DP
- 简单dp
- 简单dp
- 简单DP
- 简单dp
- 简单DP
- 简单?dp
- 简单dp
- uva725division
- JAVA-线程/线程锁
- 每日练习0930
- bash: use: command not found (error occurred this command run in Terminal: # use mysql )
- Opencv2.4.9+VS2010环境搭建问题
- hdu5904 简单dp
- typecho-出现500server error页面怎么解决?
- Win7 + Ubuntu16.04 双系统安装
- [50Tproject-1] 利润
- Xgboost gbdt
- for(;;)和while(1)的区别
- selector和layer-list一起使用
- java命令执行jar包的方式
- 剖析pthread_cancel()