Cod sursa(job #663766)

Utilizator feelshiftFeelshift feelshift Data 18 ianuarie 2012 22:01:54
Problema Subsir crescator maximal Scor 35
Compilator cpp Status done
Runda Arhiva educationala Marime 0.54 kb
// http://infoarena.ro/problema/scmax
#include <fstream>
using namespace std;

const int MAXSIZE = 100001;

ifstream in("scmax.in");
ofstream out("scmax.out");

int length,maxim;
int v[MAXSIZE],best[MAXSIZE],previous[MAXSIZE];

int main()
{
	in >> length;
	for(int i=1;i<=length;i++)
		in >> v[i];
	in.close();

	for(int i=2;i<=length;i++)
		for(int k=1;k<i;k++)
			if(v[k] < v[i] && best[i] < best[k] + 1)	
			{
				best[i] = best[k] + 1;
				maxim = max(maxim,best[i]);
			}

	out << ++maxim << "\n";

	return (0);
}