CASEY_lzpF @ 2024-08-06 22:21:42
#include <bits/stdc++.h>
#include <vector>
#include <queue>
#include <stack>
#define int long long
#define float double
using namespace std;
int n;
int a[5001];
int ans;
int mx=-1;
void dp(int i,int x){
if(i == n){
mx = max(mx,x);
return ;
}
for(int j = i;j<=n;j++){
if(a[i] < a[j]){
dp(j,x+1);
}
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin>>n;
for(int i = 1;i<=n;i++){
cin>>a[i];
}
dp(1,1);
cout<<mx;
return 0;
}
by wangzaixi @ 2024-08-25 08:49:37
@wangzaixi 思路使用
by wangzaixi @ 2024-08-25 09:16:10
by wangzaixi @ 2024-08-25 14:34:12
@wangzaixi 你试一下能不能AC