Pagini recente » Cod sursa (job #2094199) | Cod sursa (job #2089875) | Cod sursa (job #1460078) | Cod sursa (job #626025) | Cod sursa (job #1390647)
#include <iostream>
#include <fstream>
#define N 100005
using namespace std;
ifstream fin("scmax.in");
ofstream fout("scmax.out");
int a[N], b[N], p[N], n;
inline int Best(int i, int x)
{
int bst = 0;
for (i-- ; i > 0; i--)
if (x > a[i] && b[i] > bst)
bst = b[i];
return bst;
}
int main()
{
int i, bb = 0;
fin >> n;
for (i = 1; i <= n; i++)
fin >> a[i];
for (i = 1; i <= n; i++)
b[i] = 1 + Best(i, a[i]);
for (i = 1; i <= n; i++)
if (bb < b[i])
bb = b[i];
fout << bb << "\n";
return 0;
}