Pagini recente » Cod sursa (job #2477354) | Cod sursa (job #3263750) | Cod sursa (job #1383012) | Cod sursa (job #1224997) | Cod sursa (job #1366533)
#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;
best[n]=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;
}