在劝退边缘徘徊…… 复习了下lower_bound 和 upper_bound
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
int dp[maxn];
int a[maxn];
int len=0;
int n;
void lis()
{
len = 0;
dp[0]=-0x3f3f3f3f;
for(int i=1; i<=n; i++)
{
if(a[i]>dp[len]) dp[++len]=a[i];
else
{
int pos=lower_bound(dp+1,dp+len+1,a[i])-dp;
dp[pos]=a[i];
}
}
}
int main()
{
cin>>n;
for(int i = 1; i<=n; i++) cin>>a[i];
lis();
cout<<len<<endl;
return 0;
}