#include <bits/stdc++.h> using namespace std; int d[100011],n,len,a[100011]; int main(){ // freopen(".in","r",stdin); // freopen(".out","w",stdout); scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d",&a[i]); len=1; d[1]=a[1]; for(int i=2;i<=n;i++){ if(a[i]==d[len])continue; if(a[i]>d[len])d[++len]=a[i]; else *lower_bound(d+1,d+1+len,a[i])=a[i]; } printf("%d",len); return 0; }
标签:int,len,freopen,100011,序列,nlogn,模板 From: https://www.cnblogs.com/gui-ling/p/16901191.html