第一次在博客园写博客,好紧张 。博客搬家居然很多代码成了乱码,欲哭无泪,妈咪。 

开学东西太多了吧,没时间写备注,有点时候只能贴个代码,以后有时间再加备注吧,只贴代码不是好习惯。

咦,贪心怎么写,我只会lowerbound(Q……Q)

 

 

#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<memory.h>
#include<algorithm>
#include<cmath>
using namespace std;
int a[100000];
int main()
{
    int i,j,k,L=0,x,T,Minmax,pos;
    while(~scanf("%d",&T))
    {   
        L=0;
        for(i=1;i<=T;i++){
           scanf("%d",&x);
           pos=upper_bound(a+1,a+L+1,x)-a;
           if(pos>L)L++;
           a[pos]=x;
        }
        printf("%d\n",L);
    }
    return 0;
}

 

相关文章:

  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
  • 2021-06-30
猜你喜欢
  • 2021-11-18
  • 2022-12-23
  • 2021-10-26
  • 2022-02-06
  • 2022-12-23
  • 2022-02-04
  • 2021-11-18
相关资源
相似解决方案