-
Notifications
You must be signed in to change notification settings - Fork 0
/
LIS.cpp
43 lines (38 loc) · 911 Bytes
/
LIS.cpp
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
37
38
39
40
41
42
43
#include <iostream>
#include <stdio.h> // printf,scanf
#include <stdlib.h>
#include <math.h>
#include <string>
#include <vector>
#include <algorithm> //sort,binarySearch
#include <functional>
#include <iomanip> // setprecision
#include <utility> // c+11 Array
#include <set>
#include <sstream>
#include <bits/stdc++.h>
#define PI 3.141592653589793238462643383279
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define debug(x) cout << #x << " = " << x << endl;
#define debret(x) debug(x) ; return 0;
using namespace std;
int main(){
int N;
int a[1001];
int dp[1001] = {};
cin >> N;
for(int i=0; i<N; i++) cin >> a[i];
int ans = 1;
for(int i=0; i<N; i++)
{
dp[i] = 1;
for(int j=0; j<i; j++)
{
if(a[j] < a[i]) dp[i] = max(dp[i],dp[j]+1);
}
ans = max(ans,dp[i]);
}
cout << ans << endl;
return 0;
}