弦巻こころ @ 2018-04-29 23:48:00
using namespace std; int a[20005],b[20005],c[500005],d[20005][6],f[20005],g[500005],len,j; int bs(int key, int g, int low, int high) { while (low < high) { int mid = (low + high) >> 1; if (key >= g[mid]) low = mid + 1; else high = mid; } return low; } int main() { int n; scanf("%d",&n); for(int i=1;i<=5n;i++) { scanf("%d",&a[i]); } for(int i=1;i<=5n;i++) { scanf("%d",&b[i]); d[b[i]][f[b[i]]+1]; f[b[i]]++; } int z=1; for(int i=1;i<=5n;i++) { for(int j=1;j<=5;j++) { c[z]=d[a[i]][j]; z++; } z=5*i+1; } g[1] = c[0], len = 1; for (int i = 1; i < z; i++) { if (g[len] < c[i]) j = ++len; else j = bs(c[i], g, 1, len + 1); g[j] = c[i]; } cout << len << endl; }
by 弦巻こころ @ 2018-04-29 23:57:14
哇晃了一眼发现没有赋值就有点尴尬了
by Randyhoads @ 2018-04-30 08:51:07
@maojinyang 强
by 弦巻こころ @ 2018-04-30 09:38:59
@WLZS 弱 别抄我代码就行了
by Randyhoads @ 2018-04-30 13:35:28
@maojinyang 早A了