Advertisement
tuki2501

LIS_SET.cpp

Dec 4th, 2021
1,130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long ll;
  5.  
  6. signed main() {
  7.   cin.tie(0)->sync_with_stdio(0);
  8.   int n; cin >> n;
  9.   multiset<int> s;
  10.   for (int i = 0; i < n; i++) {
  11.     int x; cin >> x;
  12.     auto it = s.upper_bound(-x);
  13.     if (it != s.end()) s.erase(it);
  14.     s.insert(-x);
  15.   }
  16.   cout << s.size() << '\n';
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement