Pagini recente » Cod sursa (job #1373153) | Cod sursa (job #1552744) | Cod sursa (job #1340562) | Cod sursa (job #1964906) | Cod sursa (job #524514)
Cod sursa(job #524514)
#include <fstream.h>
ifstream fin("scmax.in");
ofstream fout("scmax.out");
int n,j,i,d[10000],max,r;
long int v[100000];
int main()
{
fin>>n;
for (i=1;i<=n;i++)
fin>>v[i];
for (i=1;i<=n;i++)
{
max = 0;
for (j=1;j<i;j++)
if (v[j]<v[i] && d[j]>max)
max = d[j];
d[i] = max + 1;
}
max = 0;
for (i=1;i<=n;i++)
if (max<d[i])
max = d[i];
fout<<max<<'\n';
fin.close();
fout.close();
return 0;
}