Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define N 1001
- using namespace std;
- int d[N]; /// d[i]=capatul celui de-al i-lea subsir
- int main()
- {
- int n;
- cin>>n;
- int k=0;
- d[0]=50001;
- int x,p;
- for(int i=1;i<=n;++i)
- {
- cin>>x;
- if(x<=d[k])
- d[++k]=x;
- else
- {
- for(p=1;d[p]>=x;++p)
- ;
- d[p]=x;
- }
- }
- cout<<k<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement