Pagini recente » Cod sursa (job #2965933) | Cod sursa (job #1397114) | Cod sursa (job #2477295) | Cod sursa (job #89638) | Cod sursa (job #1366545)
#include <iostream>
#include <fstream>
using namespace std;
const int nmax=100001;
int n,a[nmax],best[nmax];
void citire()
{
ifstream fin("scmax.in");
fin>>n;
for(int i=1;i<=n;++i)
fin>>a[i];
}
void subsir2()
{
ofstream fout("scmax.out");
int bmax=0;
for(int i=1;i<=n;++i)
best[i]=1;
for(int i=n-1;i>=1;--i)
for(int j=i+1;j<=n;++j)
if(a[i]<a[j] && best[i]<=best[j])
best[i]=best[j]+1 ;
for(int i=1;i<=n;++i)
if(bmax<best[i])
bmax=best[i];
fout<<bmax;
}
int main()
{
citire();
subsir2();
return 0;
}