Segment Tree Lazy Propagation 
Complexity
Time complexity: O(nlogn)

Space complexity: O(n)
Code
# Complexity
- Time complexity: $$O(n log n)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: $$O(n)$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
    unordered_map<int, int> prevObs;
    vector<int> t; // segment tree
    vector<int> d; // delayed operation
    int n, h;

    // apply changes to i and leave the rest for later
    void apply(int i, int val) {
        t[i] += val;
        if(i < n) {
            d[i] += val;
        }
    }

    // propagate changes to parent
    void build(int i) {
        while(i > 1) {
            i >>= 1;
            t[i] = max(t[i << 1], t[(i << 1) | 1]) + d[i];
        }
    }

    // push delayed operations to the child nodes
    void push(int i) {
        for(int s = h ; s > 0 ; s--) {
            int j = i >> s;
            if (d[j] != 0) {
                apply(j << 1, d[j]);
                apply(j << 1 | 1, d[j]);
                d[j] = 0;
            }
        }
    }

    void updateSeg(int l, int r, int val) {
        l += n;
        r += n;
        int l0 = l, r0 = r;
        for ( ; l < r ; l >>= 1, r >>= 1) {
            if (l & 1) {
                apply(l++, val);
            }
            if (r & 1) {
                apply(--r, val);
            }
        }
        build(l0);
        build(r0 - 1);
    }

    int getMax(int l, int r) {
        l += n; 
        r += n;
        push(l);
        push(r - 1);
        int ans = 0;
        for( ; l < r ; l >>= 1, r >>= 1) {
            if(l & 1) {
                ans = max(ans, t[l++]);
            }
            if(r & 1) {
                ans = max(ans, t[--r]);
            }
        }
        return ans;
    }

public:
    vector<bool> getResults(vector<vector<int>>& queries) {
        n = 50001, h = sizeof(int) * 8 - __builtin_clz(n);
        prevObs[50000] = 0;
        t.resize(100002);
        d.resize(50001);
        for(int i = 0 ; i <= 50000 ; i++) {
            t[50001 + i] = 50000 - i;
        }
        for(int i = 50000 ; i > 0 ; i--) {
            t[i] = max(t[i<<1], t[i<<1 | 1]);
        }
        vector<bool> ans;
        for(auto &query : queries) {
            if(query[0] == 1) {
                push(n + query[1]);
                int nextObs = query[1] + t[n + query[1]];
                int oldPrevObs = prevObs[nextObs];
                prevObs[query[1]] = oldPrevObs;
                prevObs[nextObs] = query[1];
                int diff = t[n + query[1]];
                updateSeg(oldPrevObs, query[1], -diff);
            } else {
                if(query[1] < query[2]) {
                    ans.push_back(false);
                } else {
                    int maxDis = getMax(0, query[1] - query[2] + 1);
                    ans.push_back(maxDis >= query[2]);
                }
            }
        }
        return ans;
    }
};
```
['C++']