Pagini recente » Cod sursa (job #154224) | Cod sursa (job #1557346) | Diferente pentru algoritmiada-2015 intre reviziile 11 si 10 | Cod sursa (job #1524426) | Cod sursa (job #1784687)
#include <fstream>
using namespace std;
ifstream in("scmax.in");
ofstream out("scmax.out");
int main()
{
int n,v[100001],best[100001],i,j,x,ma=0;
in>>n;
for (i=1;i<=n;i++)
in>>v[i];
for (i=1;i<=n;i++)
{
best[i]=1;
for (j=1;j<i;j++)
{
if (v[j]<v[i]&&best[j]>=best[i])
best[i]=1+best[j];
}
if (best[i]>ma) ma=best[i];
}
out<<ma;
return 0;
}