Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int tab[n];
- for(int i = 0; i < n; i++) cin >> tab[i];
- int c[n];
- for (int i = 0; i < n; i++){
- int k;
- for (int j = 0; j < i; j++ )
- if ( tab[j] <= tab[i] && c[j] > k )
- k = c[j];
- c[i] = k +1
- }
- cout << *max_element(c, c + n) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement