Greatest Common Increasing Subsequence hdu1423
Greatest Common Increasing Subsequence
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 3649 Accepted Submission(s): 1147
#include <iostream>
#include <cstdio>
#include <cstring>
#define clr(x,y) memset(x,y,sizeof(x))
using namespace std;
int a[],b[],ans[],an,bn;
int work()
{
memset(ans,,sizeof(ans));
int i,j,t,maxa,maxan=;
for(i=; i<=an; i++)
{
maxa=;
for(j=; j<=bn; j++)
{
if(a[i]>b[j]&&ans[j]>maxa)maxa=ans[j];
if(a[i]==b[j]&&ans[j]<maxa+)
ans[j]=maxa+;
}
}
for(i=;i<=bn;i++)
if(ans[i]>maxan)maxan=ans[i];
return maxan;
}
int main()
{
int t,i;
scanf("%d",&t);
while(t--)
{
scanf("%d",&an);
for(i=; i<=an; i++)scanf("%d",&a[i]);
scanf("%d",&bn);
for(i=; i<=bn; i++)scanf("%d",&b[i]);
printf("%d\n",work());
if(t)printf("\n");
}
}
Greatest Common Increasing Subsequence hdu1423的更多相关文章
- HDU1423:Greatest Common Increasing Subsequence(LICS)
Problem Description This is a problem from ZOJ 2432.To make it easyer,you just need output the lengt ...
- HDU 1423 Greatest Common Increasing Subsequence LCIS
题目链接: 题目 Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: ...
- POJ 2127 Greatest Common Increasing Subsequence -- 动态规划
题目地址:http://poj.org/problem?id=2127 Description You are given two sequences of integer numbers. Writ ...
- HDOJ 1423 Greatest Common Increasing Subsequence -- 动态规划
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1423 Problem Description This is a problem from ZOJ 2 ...
- ZOJ 2432 Greatest Common Increasing Subsequence(最长公共上升子序列+路径打印)
Greatest Common Increasing Subsequence 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problem ...
- HDU 1423 Greatest Common Increasing Subsequence(最长公共上升LCIS)
HDU 1423 Greatest Common Increasing Subsequence(最长公共上升LCIS) http://acm.hdu.edu.cn/showproblem.php?pi ...
- POJ 2127 Greatest Common Increasing Subsequence
You are given two sequences of integer numbers. Write a program to determine their common increasing ...
- HDUOJ ---1423 Greatest Common Increasing Subsequence(LCS)
Greatest Common Increasing Subsequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536 ...
- POJ 1423 Greatest Common Increasing Subsequence【裸LCIS】
链接: http://acm.hdu.edu.cn/showproblem.php?pid=1423 http://acm.hust.edu.cn/vjudge/contest/view.action ...
随机推荐
- 九天学会Java,第五天,函数定义函数调用
变量和数据类型,赋值和输出 算术运算 选择结构 循环结构 函数定义,函数调用 变量作用域 栈,程序运行的基石 面向对象 异常处理 语言提供的公用包 什么是函数,为什么有函数,大家可能有这样的疑问. 举 ...
- Ext:ComboBox实战
var gsCombo = new Ext.form.ComboBox({ id:'combo', hiddenName:'value', fieldLabel:'下拉框', triggerActio ...
- adb 安装apk 报错:Failure [INSTALL_FAILED_ALREADY_EXISTS]
遇到INSTALL_FAILED_ALREADY_EXISTS问题,直接通过adb install -r xxx.apk命令安装apk即可
- MySQL视图view/存储过程和函数的使用
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px "Helvetica Neue"; color: #454545 } p. ...
- JSON 理解
转自: http://blog.csdn.net/qyf_5445/article/details/8635578 (json很全面的理解) http://www.cnblogs.com/haitao ...
- 九度OJ 1016 火星A+B AC版
#include <iostream> #include <string.h> #include <sstream> #include <math.h> ...
- 【1414软工助教】团队作业5——测试与发布(Alpha版本) 得分榜
题目 团队作业5--测试与发布(Alpha版本) 作业提交情况情况 所有团队按时提交. 往期成绩 个人作业1:四则运算控制台 结对项目1:GUI 个人作业2:案例分析 结对项目2:单元测试 团队作业1 ...
- java课程设计--We Talk(201521123061)
java课程设计--We Talk(201521123061) 团队博客链接:http://www.cnblogs.com/slickghost/ 数据库 一.通过Dao模式建立与数据库的连接 1.数 ...
- 201521123062《Java程序设计》第4周学习总结
1. 本周学习总结 1.1 尝试使用思维导图总结有关继承的知识点. 1.2 使用常规方法总结其他上课内容. 多态定义:同种形态不同定义 类注释格式 继承,共同行为及属性 在instanceof检查过后 ...
- 201521123077 《Java程序设计》第14周学习总结
1. 本周学习总结 1.1以你喜欢的方式(思维导图或其他)归纳总结多数据库相关内容. 2. 书面作业 1. MySQL数据库基本操作 -参考:实验任务书-题目1 建立数据库,将自己的姓名.学号作为一条 ...