Cod sursa(job #445266)

Utilizator ncbllrNegrii Costin ncbllr Data 23 aprilie 2010 12:35:39
Problema Subsir crescator maximal Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.47 kb
#include<iostream.h>

long long n,v[100000],a[10000];


int main()
 
{
	int max;
	freopen("scmax.in", "r", stdin);
	freopen("scmax.out", "w", stdout);
	
	scanf("%lld", &n);
	for(int i = 1; i <= n; i++)
	{
		scanf("%lld", &v[i]);
		a[i]++;
	}
	for(int  i=1 ;i <= n; i++)
		for(int j= i + 1 ;j<=n; j++)
		{
			if(v[i] < v[j] && a[ i ] + 1 > a[ j ]) 
				a[ j ] = a[ i ] + 1;
			if( a[ j ] > max)
				max = a[j];
			
        }
	printf("%d\n", max);
	
}