Advertisement
a53

easy_ssc

a53
Nov 11th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #define N 1001
  3. using namespace std;
  4. int d[N]; /// d[i]=capatul celui de-al i-lea subsir
  5.  
  6. int main()
  7. {
  8. int n;
  9. cin>>n;
  10. int k=0;
  11. d[0]=50001;
  12. int x,p;
  13. for(int i=1;i<=n;++i)
  14. {
  15. cin>>x;
  16. if(x<=d[k])
  17. d[++k]=x;
  18. else
  19. {
  20. for(p=1;d[p]>=x;++p)
  21. ;
  22. d[p]=x;
  23. }
  24. }
  25. cout<<k<<'\n';
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement