Advertisement
wym1111

Untitled

Oct 22nd, 2023
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define endl '\n'
  5. using ll = long long;
  6.  
  7. const int N = 2e5 + 10;
  8.  
  9. int n;
  10.  
  11. void solve () {
  12.     cin >> n;
  13.     multiset<int> stl, str;
  14.     for (int i = 1; i <= n; i ++) {
  15.         char opt;
  16.         int l, r;
  17.         cin >> opt >> l >> r;
  18.         if (opt == '+') {
  19.             stl.insert(l);
  20.             str.insert(r);
  21.         }
  22.         else {
  23.             stl.erase(stl.find(l));
  24.             str.erase(str.find(r));
  25.         }
  26.         if (stl.empty()) {
  27.             cout << "NO\n";
  28.             continue;
  29.         }
  30.         if (*stl.rbegin() > *str.begin()) cout << "YES\n";
  31.         else cout << "NO\n";
  32.     }
  33. }
  34.  
  35. signed main () {
  36.     ios::sync_with_stdio(false);
  37.     cin.tie(nullptr);
  38.    
  39.     int _ = 1;
  40. //  cin >> _;
  41.     while (_ --) {
  42.         solve();
  43.     }
  44.    
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement