2024-05-01 06:59:08 +00:00
|
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
#define MAXN 10005
|
|
|
|
#define M 200
|
|
|
|
int dp[MAXN];
|
2024-06-09 06:40:50 +00:00
|
|
|
int obstacle[M];
|
2024-05-01 06:59:08 +00:00
|
|
|
int longest_decreasing_subsequence(int n) {
|
|
|
|
int maximun = 0;
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
|
|
dp[i]++;
|
|
|
|
for (int j = 0; j < i; j++) {
|
2024-06-09 06:40:50 +00:00
|
|
|
if (obstacle[j] > obstacle[i]) // 最大上升为 `obstacle[j] < obstacle[i]`
|
2024-05-01 06:59:08 +00:00
|
|
|
dp[i] = max(dp[i], dp[j] + 1);
|
|
|
|
}
|
|
|
|
if (dp[i] > maximun)
|
|
|
|
maximun = dp[i];
|
|
|
|
}
|
|
|
|
return maximun;
|
|
|
|
}
|
|
|
|
int main() {
|
|
|
|
int N;
|
|
|
|
cin >> N;
|
|
|
|
for (int i = 0; i < N; i++) {
|
2024-06-09 06:40:50 +00:00
|
|
|
cin >> obstacle[i];
|
2024-05-01 06:59:08 +00:00
|
|
|
}
|
|
|
|
int value = longest_decreasing_subsequence(N);
|
|
|
|
cout << value << endl;
|
|
|
|
}
|