紫書上的模板還真是好套呢,我的代碼算是,不不,還是個
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
#define DEBUG
const int maxn=1000+5,maxv=26,INF=0x3f3f3f3f;
int n,d[maxn],a[maxn];
int dp(int i){
int& ans=d[i];
if(d[i]>0)return ans;
ans=1;
for(int j=i+1;j<=n;j++){
if(a[j]>a[i]) ans=max(ans,dp(j)+1);
}
return ans;
}
int main(){
#ifdef DEBUG
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
int ans=0;
for(int i=1;i<=n;i++){
ans=max(ans,dp(i));
}
printf("%d\n",ans );
#ifdef DEBUG
fclose(stdin);
fclose(stdout);
#endif
return 0;
}