【codevs3955】最长严格上升子序列(加强版)

//f[i]:长为i的LIS末位的最小值
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int f[1000010];
int main(){
    memset(f,0x3f,sizeof(f));
    int n;  cin>>n;
    for(int i = 1; i <= n; i++){
        int x;  cin>>x;
        *lower_bound(f+1,f+n+1,x) = x;
    }
    cout<<lower_bound(f+1,f+n+1,f[0])-f-1<<"
";
    return 0;
}
原文地址:https://www.cnblogs.com/gwj1314/p/9444884.html