Cod sursa(job #579145)
| Utilizator | Data | 11 aprilie 2011 21:30:38 | |
|---|---|---|---|
| Problema | Subsir crescator maximal | Scor | 35 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.51 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("scmax.in");
ofstream fout("scmax.out");
#define DIM 10001
int L[DIM];
int n, a[10001];
int main()
{
int smax = -1, i, j;
fin >> n;
for ( i = 0; i < n; ++i )
fin >> a[i];
for ( i = 0; i < n; ++i )
{
L[i] = 1;
for ( j = 0; j < i; ++j )
if ( L[j] + 1 > L[i] && a[i] > a[j] )
L[i] = L[j] + 1;
}
for ( i = 0; i < n; ++i )
if ( smax < L[i] )
smax = L[i] ;
fout << smax;
fin.close();
fout.close();
return 0;
}
