#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
const int N=1010;
int n;
int x[N];
int f[N];
int main(){
cin>>n;
for(int i=1;i<=n;i++) cin>>x[i];
//划分为n类,每类以x[i]结尾,求每类以x[i]结尾的最长上升子序列
for(int i=1;i<=n;i++){
f[i]=1;
for(int j=1;j<n;j++){
if(x[j]<x[i])
f[i]=max(f[i],f[j]+1);
}
}
int res=0;
for(int i=1;i<=n;i++)
//已经求出每一类的最大值,取他们之间最大的那个
res=max(res,f[i]);
cout<<res<<endl;
return 0;
}
展开阅读全文
© 著作权归作者所有
举报
打赏
0 赞
0 收藏
微信
QQ
微博
微博
分享