Pagini recente » Borderou de evaluare (job #2705257) | Cod sursa (job #591688) | Borderou de evaluare (job #1025176) | Cod sursa (job #2468004)
#include <iostream>
#include <fstream>
# define Nmax 100001
using namespace std;
long long n,v[Nmax],a[Nmax],i,w[Nmax],x,lung,lungmax,j,poz;
ifstream f("scmax.in");
ofstream g("scmax.out");
int main()
{f>>n;
for(i=1;i<=n;i++)f>>v[i];
for(i=1;i<=n;i++){
bool gasit=false;
for(j=1;j<=i;j++)
if(v[i]<=a[j]){
gasit=true;
a[j]=v[i];lung=j;
break;
}if(gasit==false) {lung++;a[lung]=v[i];}
}g<<lung;
}