Pagini recente » Cod sursa (job #2606873) | Cod sursa (job #517277) | Cod sursa (job #1092881) | Cod sursa (job #1061450) | Cod sursa (job #1088455)
#include <iostream>
#include <fstream>
using namespace std;
int l[100000],n,maxx,o,maxx1=0;
long a[100000];
ifstream f("scmax.in");
ofstream g("scmax.out");
void citire(){
f>>n;
for(int i=0;i<n;i++)
f>>a[i];
}
int main()
{
int i,j;
citire();
l[n-1]=1;
maxx=l[0];
for(i=n-2;i>=0;i--){
maxx1=0;
for(j=i+1;j<n;j++)
if(a[i]<a[j] && maxx1<l[j]){
maxx1=l[j]+1;
}
l[i]=maxx1;
if(maxx1>maxx){
maxx=maxx1;
o=i;
}
}
g<<maxx<<endl;
// g<<a[o]<<" ";
/* for(i=o+1;i<n;i++)
if(l[o]-l[i] == 1){
g<<a[i]<<" ";
l[o]=l[i];
}
*/
return 0;
}