mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-30 16:56:27 +00:00
31 lines
503 B
C++
31 lines
503 B
C++
#include <iostream>
|
|
|
|
using std::cin;
|
|
using std::cout;
|
|
const char endl = '\n';
|
|
|
|
const int N = 20005;
|
|
|
|
int n, a[N], f[N], ans;
|
|
|
|
int main() {
|
|
std::ios::sync_with_stdio(false);
|
|
|
|
cin >> n;
|
|
for (int i = 1; i <= n; i++) {
|
|
cin >> a[i];
|
|
}
|
|
|
|
for (int i = 1; i <= n; i++) {
|
|
f[i] = 1;
|
|
for (int j = 1; j < i; j++) {
|
|
if (a[j] >= a[i]) f[i] = std::max(f[i], f[j] + 1);
|
|
}
|
|
ans = std::max(ans, f[i]);
|
|
}
|
|
|
|
cout << ans << endl;
|
|
|
|
return 0;
|
|
}
|