-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1576.cpp
More file actions
36 lines (31 loc) · 756 Bytes
/
Copy path1576.cpp
File metadata and controls
36 lines (31 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*************************************************************************
> File Name: 1576.cpp
> Author: dulun
> Mail: dulun@xiyoulinux.org
> Created Time: 2016年02月29日 星期一 21时35分57秒
************************************************************************/
#include<iostream>
#include<stdio.h>
using namespace std;
int a[800008];
int dp[800008];
int main()
{
int n;
cin>>n;
int max = 1;
dp[0] = 1;
for(int i = 0; i < n; i++) cin>>a[i];
for(int i = 1; i < n; i++)
{
dp[i] = 1;
for(int j = 0; j < i; j++)
{
if(a[j] < a[i] && dp[j] + 1 > dp[i])
dp[i] = dp[j]+1;
}
if(dp[i] > max) max = dp[i];
}
cout<<max;
return 0;
}