Cod sursa(job #579214)

Utilizator david95szabo david emanuel david95 Data 11 aprilie 2011 22:15:18
Problema Subsir crescator maximal Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.5 kb
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("scmax.in");
ofstream fout("scmax.out");
#define DIM 10001

int L[DIM], R[DIM];

int a[10001];
int n;



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;
	}

		if ( smax < L[i]  )
			smax = L[i] ;
			

	fout <<  smax;
	fin.close();
	fout.close();
	return 0;
}