#include <iostream>
using namespace std;
typedef long long LL;
LL dp[1005];
int a[1005];
int main(){
int n;
LL ans = -1;
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
for(int i = 1; i <= n; i++){
dp[i] = 1;
for(int j = 1; j < i; j++){
if(a[j] <= a[i]){
dp[i] = max(dp[i], dp[j] + 1);
}
}
ans = max(dp[i], ans);
}
cout << ans << endl;
return 0;
}
最长递增子序列
最新推荐文章于 2024-08-23 15:15:47 发布