Cod sursa(job #694942)

Utilizator alexapoApostol Alexandru Ionut alexapo Data 28 februarie 2012 09:31:42
Problema Subsir crescator maximal Scor 35
Compilator cpp Status done
Runda Arhiva educationala Marime 0.44 kb
#include <fstream>

using namespace std;
ifstream f("scmax.in");
ofstream g("scmax.out");
long long n,v[100005],i,j,maxi,best[100005];
int main()
{
    f>>n;
    f>>v[1];
    for(i=2;i<=n;i++)
    {
        f>>v[i];
        for(j=1;j<i;j++)
        if(v[i]>v[j]&&best[i]<best[j]+1)
        best[i]=best[j]+1;
        if(best[i]>maxi)
        maxi=best[i];
    }    g<<maxi+1<<'\n';
    f.close();
    g.close();
    return 0;
}