#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[5001],b[5001],en;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
      scanf("%d",&a[i]);
    for(int i=1;i<=n;++i)
      {
        int *p=lower_bound(b+1,b+en+1,a[i]);
        if(!(*p)) ++en;
        (*p)=a[i];
      }
    printf("%d\n",en);
    return 0;
}

相关文章:

  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
猜你喜欢
  • 2021-05-28
  • 2022-12-23
  • 2022-01-09
  • 2021-11-03
  • 2021-05-23
  • 2022-01-14
  • 2022-02-17
相关资源
相似解决方案