Time Exceeded
代码
#include <bits/stdc++.h>
using namespace std;
int n,ans=0;
int a[100010];
int f[100010];
int main()
{
//freopen("sort.in","r",stdin);
//freopen("sort.out","w",stdout);
int i,j;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
cin>>a[i];
f[i]=1;
for(j=i-1;j>=1;j--)
if(a[i]>a[j])
f[i]=max(f[i],f[j]+1);
ans=max(f[i],ans);
}
printf("%d",ans);
}