Pagini recente » Cod sursa (job #1248447) | Cod sursa (job #1882534) | Cod sursa (job #1755871) | Cod sursa (job #2851437) | Cod sursa (job #2051072)
#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;
}