Cod sursa(job #2468004)
| Utilizator | Data | 5 octombrie 2019 11:35:49 | |
|---|---|---|---|
| Problema | Subsir crescator maximal | Scor | 5 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.42 kb |
#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;
}
