Cod sursa(job #2051072)

Utilizator vulpixbSilvasan Bogdan vulpixb Data 28 octombrie 2017 15:10:52
Problema Subsir crescator maximal Scor 35
Compilator cpp Status done
Runda Arhiva educationala Marime 0.68 kb
#include <bits/stdc++.h>

using namespace std;

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

int a[2000000], best[2000000], n, lmax=1, i, j, p1, p2;
int main()
{
    fin >> n;
    for (i=0; i<n; i++)
        fin >> a[i];

    best[n-1] = 1;
    for (i=n-2; i>=0; i--)
    {
        best[i] = 1;
        for (j=i+1; j<n; j++)
        {
            if (a[i] < a[j] && best[i] < best[j] + 1)
            {
                best[i] = best[j] + 1;
                if (best[i] > lmax) lmax = best[i], p1=i, p2=j;
            }
        }
    }


    fout << lmax << "\n";
    /*
    for (p1; p1<=p2; p1++)
    {
        if ()
    }
    */

    return 0;
}