Mai intai trebuie sa te autentifici.
Cod sursa(job #1607915)
| Utilizator | Data | 21 februarie 2016 18:29:10 | |
|---|---|---|---|
| Problema | Subsir crescator maximal | Scor | 50 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <bits/stdc++.h>
using namespace std;
string s = "scmax.";
ifstream f(s+"in");
ofstream g(s+"out");
map<int,int> m;
int n,a,b,c,po,v[100001],p[100001];
int main()
{
f>>n;
m[0]=0;
while(n--)
{
f>>a;
auto it=m.lower_bound(a);--it;
m[a]=b=it->second+1;
if (b>c)
{
c=b;
po=n;
}
it=m.lower_bound(a);++it;
while(it!=m.end()&&it->second<=b)
m.erase(it++);
}
g<<c<<'\n';
return 0;
}
