博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
第一轮 D
阅读量:4584 次
发布时间:2019-06-09

本文共 1903 字,大约阅读时间需要 6 分钟。

Virus

Time Limit:1000MS Memory Limit:0KB 64bit IO Format:%lld & %llu
Submit Status
Description
Download as PDF
Virus
We have a log file, which is a sequence of recorded events. Naturally, the timestamps are strictly increasing.
However, it is infected by a virus, so random records are inserted (but the order of original events is preserved). The backup log file is also infected, but since the virus is making changes randomly, the two logs are now different.
Given the two infected logs, your task is to find the longest possible original log file. Note that there might be duplicated timestamps in an infected log, but the original log file will not have duplicated timestamps.
Input
The first line contains T ( T$ \le$100), the number of test cases. Each of the following lines contains two lines, describing the two logs in the same format. Each log starts with an integer n ( 1$ \le$n$ \le$1000), the number of events in the log, which is followed by n positive integers not greater than 100,000, the timestamps of the events, in the same order as they appear in the log.
Output
For each test case, print the number of events in the longest possible original log file.
Sample Input
1
9 1 4 2 6 3 8 5 9 1
6 2 7 6 3 5 1
Sample Output

3

最长公共子序列匹配

/*************************************************************************	> File Name: e.cpp	> Author:yuan 	> Mail: 	> Created Time: 2014年11月09日 星期日 16时37分18秒 ************************************************************************/#include
#include
#include
#include
#include
#include
using namespace std;int a[1007],b[1007],dp[1007];int t,n,m;int main(){ scanf("%d",&t); while(t--){ memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); memset(dp,0,sizeof(dp)); scanf("%d",&n); for(int i=0;i
b[j]&&MAX

 

转载于:https://www.cnblogs.com/codeyuan/p/4254393.html

你可能感兴趣的文章
ab测试工具的使用
查看>>
RTL基本知识:编译命令指定隐性线网类型
查看>>
java中BigDecimal在金融行业中的使用
查看>>
66.Plus One
查看>>
爬虫——小结
查看>>
sticky bit
查看>>
sqlserver 中 where 条件和 join 条件的作用比较
查看>>
jvm解析和调优
查看>>
Linux 连接mysql服务器
查看>>
linux内核学习:中断中推后执行的部分
查看>>
数据库系统概论【基础篇】
查看>>
shell脚本中大于,大于等于,小于,小于等于、不等于的表示方法
查看>>
xcode 快捷键
查看>>
三十五.MySQL读写分离 MySQL多实例 、MySQL性能调优
查看>>
[LeetCode] 256. Paint House_Easy tag: Dynamic Programming
查看>>
Java基础——面向对象编程一:封装
查看>>
python ==> Django.view(登录,注册,个人页)
查看>>
在maven中没有的jar包如何处理?
查看>>
多线程与UI操作
查看>>
python 打印三角行,金字塔等
查看>>