-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelis.cpp
More file actions
39 lines (36 loc) · 700 Bytes
/
elis.cpp
File metadata and controls
39 lines (36 loc) · 700 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
37
38
39
#include <iostream>
#include <cstring> //memset
#include <algorithm>
#include <bitset>
#include <string>
#include <vector>
#include <utility>
#include <cstdio>
#include <queue>
#include <cmath>
#include <list>
#include <set>
#include <map>
using namespace std;
int A[15], dp[15];
void lis(int len) {
int mx = 0;
for (int i = 0; i < len; i++)
dp[i] = 1;
for (int i = 1; i < len; i++)
for (int j = 0; j < i; j++)
if (A[i] > A[j] && dp[i] < dp[j]+1)
dp[i] = dp[j] + 1;
for (int i = 0; i < len; i++)
mx = max(mx, dp[i]);
cout << mx << endl;
}
int main() {
freopen("input.txt", "r", stdin);
int len;
cin >> len;
for (int i = 0; i < len; i++)
cin >> A[i];
lis(len);
return 0;
}