标签:pre iostream math solution scanf name 优化 out else
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int MAXX=100010;
int a[MAXX],stack[MAXX];
int top,n;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;++i)scanf("%d",&a[i]);
for(int i=1;i<=n;++i){
if(a[i]>stack[top])stack[++top]=a[i];
else {
int pos=lower_bound(stack+1,stack+top+1,a[i])-stack;
stack[pos]=a[i];
}
}
cout<<top;
return 0;
}
标签:pre iostream math solution scanf name 优化 out else
原文地址:https://www.cnblogs.com/ARTlover/p/9538393.html