Cod sursa(job #1097912)

Utilizator Johny_Depp22Johnny Depp Johny_Depp22 Data 4 februarie 2014 10:49:46
Problema Subsir crescator maximal Scor 35
Compilator cpp Status done
Runda Arhiva educationala Marime 0.48 kb
#include <fstream>
using namespace std;
ifstream f("scmax.in");
ofstream g("scmax.out");

int N, v[100002], L[100002], lmax;

int main()
{
    f>>N; v[0]=200000000; L[N]=1;
    for (int i=1; i<=N; ++i)
        f>>v[i], L[i]=1;
    for (int i=N-1; i>0; --i)
        for (int j=i+1; j<=N; ++j)
            if (v[i]<v[j] && L[j]+1>L[i])
            {
                L[i]=L[j]+1;
                if (lmax<L[i]) lmax=L[i];
            }
    g<<lmax<<'\n';
    return 0;
}