标签:mem 结合 ott ring content scribe href include ems
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int inf = 0x7ffffff; int t,l1,l2,a[510],b[510],f[510][510],ans,maxx; int main() { scanf("%d",&t); while (t--) { memset(f,0,sizeof(f)); ans = 0; scanf("%d",&l1); for (int i = 1; i <= l1; i++) scanf("%d",&a[i]); scanf("%d",&l2); for (int i = 1; i <= l2; i++) scanf("%d",&b[i]); for (int i = 1; i <= l1; i++) { maxx = 0; for (int j = 1; j <= l2; j++) { f[i][j] = f[i - 1][j]; if (a[i] > b[j]) maxx = max(maxx,f[i-1][j]); if (a[i] == b[j]) f[i][j] = maxx + 1; } } for (int i = 1; i <= l2; i++) ans = max(ans,f[l1][i]); if (t != 0) printf("%d\n\n",ans); else printf("%d\n",ans); } return 0; }
标签:mem 结合 ott ring content scribe href include ems
原文地址:http://www.cnblogs.com/zbtrs/p/7478417.html