Segment Tree
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    class SGT{\n        vector<int>seg;\n        public:\n        SGT (int n){\n            seg.resize(4*n+1);\n        }\n        void build(int ind,int l,int h,vector<int>&a){\n            if(l==h){\n                seg[ind]=a[l];\n                return;\n            }\n            int m=(h+l)/2;\n            build(2*ind+1,l,m,a);\n            build(2*ind+2,m+1,h,a);\n            seg[ind]=max(seg[2*ind+1],seg[2*ind+2]);\n        }\n        void update(int ind,int l,int h,int i,int v){\n            if(l==h){\n                seg[ind]=v;\n                return;\n            }\n            int m=(h+l)/2;\n            if(i<=m) update(2*ind+1,l,m,i,v);\n            else update(2*ind+2,m+1,h,i,v);\n            seg[ind]=max(seg[2*ind+1],seg[2*ind+2]);\n\n        }\n        int query(int ind,int l,int h,int lt,int rt){\n            //cout<<l<<" "<<h<<" ";\n            if(rt<l || lt>h) return INT_MIN;\n            if(l>=lt && h<=rt) return seg[ind];\n            int m=(l+h)/2;\n            int left=query(2*ind+1,l,m,lt,rt);\n            int right=query(2*ind+2,m+1,h,lt,rt);\n            return max(right,left);\n        }\n    };\n\n    vector<bool> getResults(vector<vector<int>>& q) {\n        vector<int>a(5*1e4+1,0);\n        SGT sg(5*1e4+1);\n        sg.build(0,0,5*1e4,a);\n        vector<bool>ans;\n        set<int>obs;\n        obs.insert(0);\n        obs.insert(1e5);\n        for(int i=0;i<q.size();i++){\n            \n            if(q[i].size()==2){\n                int x=q[i][1];\n                auto it=obs.lower_bound(x);\n                \n                    sg.update(0,0,5*1e4,x,*it-x);\n                \n                \n                    it--;\n                    sg.update(0,0,5*1e4,*it,x-*it);\n                    obs.insert(x);\n                \n\n            }\n            else{\n\n                int x=q[i][1];\n                int s=q[i][2];\n                auto it=obs.lower_bound(x);\n                auto ii=obs.begin();ii++;\n                if(it==ii && s<=x){\n                    ans.push_back(true);\n                    continue;\n                }\n                int b=sg.query(0,0,5*1e4,0,x-s);\n                cout<<b<<" ";\n                if(b>=s) ans.push_back(true);\n                else ans.push_back(false);\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']