Cod sursa(job #694939)

Utilizator alexapoApostol Alexandru Ionut alexapo Data 28 februarie 2012 09:28:15
Problema Subsir crescator maximal Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.45 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]++;
        if(best[i]>maxi)
        maxi=best[i];
    }
    if(maxi)
    g<<maxi<<'\n';
    else
    g<<1<<'\n';
    f.close();
    g.close();
    return 0;
}