mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-24 11:28:47 +00:00
24 lines
435 B
C++
24 lines
435 B
C++
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int n, a[1005], f[1005], ans;
|
||
|
|
||
|
int main() {
|
||
|
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] = max(f[i], f[j] + 1);
|
||
|
}
|
||
|
}
|
||
|
ans = max(ans, f[i]);
|
||
|
}
|
||
|
cout << ans << endl;
|
||
|
return 0;
|
||
|
}
|