标签:n+1 algo iostream turn amp cst scanf main ios
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,t,len,a[10005],d[10005];
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
if(n==0)
{
printf("0\n");
return 0;
}
d[++len]=a[1];
for(int i=2;i<=n;i++)
{
if(a[i]>=d[len])
d[++len]=a[i];
else
{
t=upper_bound(d+1,d+len+1,a[i])-d;
d[t]=a[i];
}
}
printf("%d\n",len);
return 0;
}
标签:n+1 algo iostream turn amp cst scanf main ios
原文地址:https://www.cnblogs.com/Hawking-llfz/p/11864217.html