2015/2/12
最长上升子序列。
水过。
#include<map>
#include<queue>
#include<stack>
#include<cmath>
#include<vector>
#include<climits>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
#define mod 10007
#define lson pos<<1,l,mid
#define sc(n) scanf("%d",&n)
#define rson pos<<1|1,mid+1,r
#define pr(n) printf("%d\n",n)
#define met(n,m) memset(n, m, sizeof(n))
#define F(x,y,i) for(int i = x;i > y; i--)
#define f(x,y,i) for(int i = x;i < y; i++)
#define ff(x,y,i) for(int i = x;i <= y; i++)
#define FF(x,y,i) for(int i = x;i >= y; i--)
const int N=100500;
const int inf = INT_MAX;
int Max(int a,int b)
{
return a>b?a:b;
}
int Min(int a,int b)
{
return a<b?a:b;
}
int s[1005],dp[1005];
int main()
{
int n, m, tot, x;
while(~scanf("%d",&n))
{
f(0,n,i)
{
sc(s[i]);
dp[i] = 1;
}
int maxn = 1;
f(0,n,i)
f(0,i,j)
{
if(s[i] > s[j])
{
dp[i] = Max(dp[i],dp[j]+1);
}
maxn = Max(maxn,dp[i]);
}
pr(maxn);
}
return 0;
}