Cod sursa(job #693339)
| Utilizator | Data | 27 februarie 2012 11:48:43 | |
|---|---|---|---|
| Problema | Subsir crescator maximal | Scor | 35 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.42 kb |
#include<stdio.h>
using namespace std;
int main ()
{
freopen("scmax.in","r",stdin);
freopen("scmax.out","w",stdout);
int n,a[100002]={0},best[100002],i,j,max=0, m;
scanf("%d%d",&n,&a[0]);
best[0]=1;
for(i=1;i<n;i++){
scanf("%d",&a[i]);
m=i;
for(j=0;j<i;j++){
if(a[i]>a[j]&best[m]<best[j])
m=j;}
best[i]=best[m]+1;
if(best[i]>max)
max=best[i];}
printf("%d",max);
return 0;
}
