-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1965.cpp
More file actions
37 lines (29 loc) · 715 Bytes
/
1965.cpp
File metadata and controls
37 lines (29 loc) · 715 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
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include <string>
using namespace std;
int main() {
ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int N;
cin >> N;
int arr[1001];
for (int i = 0; i < N; i++) {
cin >> arr[i];
}
int dp[1001];
fill(&dp[0], &dp[1001], 1);
int maxV = 1;
for (int i = 0; i < N; i++) {
for (int j = 0; j < i; j++) {
if (arr[i] > arr[j]) {
if (dp[i] < dp[j] + 1) {
dp[i] = dp[j] + 1;
if (maxV < dp[i])maxV = dp[i];
}
}
}
}
cout << maxV;
}