HDU5904 LCIS 水题

http://acm.hdu.edu.cn/showproblem.php?pid=5904://

说是LCIS其实和LCIS没有一点儿关系的水题。
代码
 1 #include<cstdio>
 2 #include<cstring>
 3 #include<iostream>
 4 #include<algorithm>
 5 #include<cmath>
 6 using namespace std;
 7 const int maxn=100010;
 8 const double eps=1e-8;
 9 const int modn=998244353;
10 int n,m;
11 int f1[10*maxn]={};
12 int f2[10*maxn]={};
13 int main(){
14     int T;scanf("%d",&T);
15     while(T-->0){
16         scanf("%d%d",&n,&m);
17         memset(f1,0,sizeof(f1));
18         memset(f2,0,sizeof(f2));
19         int x,ma=0,ans=0,z;
20         for(int i=1;i<=n;i++){
21             scanf("%d",&x);
22             f1[x]=f1[x-1]+1;
23             ma=max(x,ma);
24         }
25         for(int i=1;i<=m;i++){
26             scanf("%d",&x);
27             f2[x]=f2[x-1]+1;
28             ma=max(x,ma);
29         }
30         for(int i=1;i<=ma;i++){
31             z=min(f1[i],f2[i]);
32             ans=max(ans,z);
33         }
34         printf("%d
",ans);
35     }
36     return 0;
37 }
View Code
原文地址:https://www.cnblogs.com/137shoebills/p/7786509.html