hdu 1423 LICS

编程入门 行业动态 更新时间:2024-10-10 00:23:13

<a href=https://www.elefans.com/category/jswz/34/1769149.html style=hdu 1423 LICS"/>

hdu 1423 LICS

看了.html

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstring>
 4 #include <queue>
 5 #include <algorithm>
 6 #include <cmath>
 7 #include <stack>
 8 #include <vector>
 9 #define LL long long
10 using namespace std;
11 const int inf=0x3f3f3f3f;
12 const int maxn=500+10;
13 int a[maxn],b[maxn],f[maxn];    
14 int main()
15 {
16     int T,n,m;
17     cin>>T;
18     while(T--)
19     {
20         int i,j;
21         cin>>n;
22         for(i=1;i<=n;i++) scanf("%d",&a[i]);
23         cin>>m;
24         for(i=1;i<=m;i++) scanf("%d",&b[i]);
25         int maxv;
26         memset(f,0,sizeof(f));
27         for(i=1;i<=n;i++)
28         {
29             maxv=0;
30             for(j=1;j<=m;j++)
31             {
32                 if(a[i]==b[j]) f[j]=maxv+1;
33                 if(a[i]>b[j]&&f[j]>maxv) maxv=f[j];
34             }
35         }
36         int ans=0;
37         for(i=1;i<=m;i++) if(f[i]>ans) ans=f[i];
38         printf("%d\n",ans);
39         if(T) printf("\n");
40     }
41     return 0;
42 }

 

转载于:.html

更多推荐

hdu 1423 LICS

本文发布于:2024-02-06 05:06:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1746749.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:hdu   LICS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!