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 ...
随机推荐
- MyBatis框架知识整理
MyBatis框架 一.介绍: MyBatis实际上是Ibatis3.0版本以后的持久化层框架[也就是和数据库打交道的框架]! 和数据库打交道的技术有: 原生的JDBC技术---> Spring ...
- Ext.grid.EditorGridPanel分页和查看全部
在gridPanel添加查看全部数据按钮,必须使得每页显示的数量pageSize为总条数,那么总页数就只会有一页. 1.获取store数据的总条数 var totalCount = grid.getS ...
- 为Ext添加下拉框和日期组件
Ext.onReady(function(){ var config = { fields:['module'], data:[['新建'],['删除'],['增加']}; var store = n ...
- sed修炼系列(四):sed中的疑难杂症
本文目录:1 sed中使用变量和变量替换的问题2 反向引用失效问题3 "-i"选项的文件保存问题4 贪婪匹配问题5 sed命令"a"和"N" ...
- awk知识点全回顾
本文目录:1.awk简介和基本语法格式2.print和printf格式化输出3.输入行的字段分隔符和行分隔符4.BGEIN和END5.数组6.流程控制语句 6.1 条件判断语句 6.2 while循环 ...
- ABB-robotstudio离线编程-Smart组件资料-笔记
Smart组件 目录: 1.“信号与属性”子组件. 2.“参数与建模”子组件. 3.“传感器”子组件. 4.“动作”子组件. 5.“本体”子组件. 6.“其他”子组件. 一.“信号与属牲”子组件 1. ...
- unix下的文件和目录详解以及操作方法
前言:unix下一切东西都是文件,一共有7种不同的文件,前一篇博客已经讲解的很清楚了,不懂的可以看看这里.当然,博主知道有些朋友比忙,没时间看,那我就简单点讲讲这7中文件都有哪些吧. 文件类型包括在s ...
- 使用github出了些问题?fatal: unable to access;Failed connect to github.com:8087;
使用github出了些问题?fatal: unable to access;Failed connect to github.com:8087; No error 我今天使用git push orig ...
- 软工+C(2017第7期) 野生程序员
// 上一篇:最近发展区/脚手架 // 下一篇:提问和回复 怎样做足够好的软件?我们就差一个程序员! 没有什么软件工程的理论的时候,程序员们凭借自己对编程的热爱,凭借着:"这是一个可以自动化 ...
- 第6周-接口、内部类与Swing
1. 本周学习总结 1.1 面向对象学习暂告一段落,请使用思维导图,以封装.继承.多态为核心概念画一张思维导图,对面向对象思想进行一个总结. 注1:关键词与内容不求多,但概念之间的联系要清晰,内容覆盖 ...