lower_bound写法
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N = 1e5+10;
int n;
int a[N];
int f[N];
int main()
{
cin>>n;
for(int i = 0;i<n;i++)cin>>a[i];
int len = 0;
for(int i = 0;i<n;i++)
{
int pos = lower_bound(f+1,f+len+1,a[i]) - f;
f[pos] = a[i];
len = max(len,pos);
}
cout<<len<<endl;
return 0;
}