#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 10010;
int dp[maxn], ans = -1, A[maxn], order[maxn] = {0}, cnt = 0;
int main(){
int n, m, k, num;
cin >> n >> m;
for(int i = 1; i <= m; i++){
cin >> num;
order[num] = i;
}
cin >> k;
for(int i = 1; i <= k; i++){
cin >> num;
if(order[num] == 0) continue;
else A[cnt++] = order[num];
}
for(int i = 0; i < cnt; i++){
dp[i] = 1;
for(int j = 0; j < i; j++){
if(A[i] >= A[j] && dp[j] + 1 > dp[i]){
dp[i] = dp[j] + 1;
}
}
ans = max(ans, dp[i]);
}
printf("%d", ans);
return 0;
}
J_北冥有鱼
发布了165 篇原创文章 · 获赞 0 · 访问量 1728
私信
关注