LIS最长上升子序列

#include<bits/stdc++.h>
#define MAX 0x3f3f3f3f
using namespace std;
int n;
int len[100005],now=0;
int ls;
int main(){
scanf("%d",&n);
len[now]=-MAX;
for(int i=1;i<=n;i++){
scanf("%d",&ls);
if(ls>len[now])
len[++now]=ls;
else{
len[upper_bound(len+1,len+1+now,ls)-len]=ls;
}
}
cout<<now;
//

当出现两个序列匹配的问题;

可以将其中一个数列的每一个数映射为1,2,3,4,5,6.·····

然后将另一个序列用本数列的映射表示,最后用lis求解

return 0;
}

二分写法(高级!)

https://blog.csdn.net/shuangde800/article/details/7474903

https://www.luogu.org/blog/w1049/solution-p1020

原文地址:https://www.cnblogs.com/zyfltyyz/p/11719202.html