SHARE
TWEET

LIQ, Đạt

a guest Jan 17th, 2020 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top