40pts
查看原帖
40pts
768870
valen071楼主2024/10/19 19:07
#include <bits/stdc++.h>
using namespace std;
#define int long long
int f[10010],n,a[100010];
signed main(){
    cin >> n;
    f[1]=1;
    for(int i=1;i<=n;i++)cin >> a[i];
    for(int i=2;i<=n;i++){
        int m=-1e9;
        f[i]=1;
        for(int j=i;j>=1;j--){
            if(f[j]>m&&a[j]<a[i]){
            	f[i]=f[j]+1;
            	m=f[j];
			}
        }
    }
    cout << f[n];
    return 0;
}
2024/10/19 19:07
加载中...