Advertisement
Guest User

LIQ, Đạt

a guest
Jan 17th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define For(i, a, b) for(int i = a; i <= b; i++)
  6. #define Ford(i, a, b) for(int i = a; i >= b; i--)
  7.  
  8. int n, a[1010], dem[1010], t = 0;
  9.  
  10. void process()
  11. {
  12.     For(i, 2, n)
  13.     For(j, 1, i-1)
  14.     if (a[j] < a[i]) dem[i] = max(dem[i], dem[j]+1);
  15. }
  16.  
  17. void input()
  18. {
  19.     cin >> n;
  20.     For(i, 1, n) cin >> a[i];
  21. }
  22.  
  23. int main()
  24. {
  25.     fill(dem, dem+1010, 1);
  26.     input();
  27.     process();
  28.     For(i, 1, n) t= max(t, dem[i]);
  29.     cout << t;
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement