C++ | map
\n\n# Code\n\nclass Solution {\npublic:\n    vector<bool> getResults(vector<vector<int>>& queries) {\n       map<int,int> link;\n       link[0]=0;\n       link[
\n\n# Code\n```\nclass Solution {\npublic:\n    vector<bool> getResults(vector<vector<int>>& queries) {\n       map<int,int> link;\n       link[0]=0;\n       link[INT_MAX]=INT_MAX;\n       vector<bool> ans;\n       for(int i=0;i<queries.size();i++){\n        int t=queries[i][0];\n        int x=queries[i][1];\n        if(t==1){\n            auto pos1=link.lower_bound(x);\n            if(pos1->first==x){ \n                continue;\n            }\n            else{\n                pos1--;\n                link[x]=max(link[pos1->first],(x-pos1->first));\n                auto pos2=link.upper_bound(x);\n                int pv=pos2->second;\n                link[pos2->first]=max(link[x],(pos2->first-x));\n                if(pv==pos2->second) continue;\n                while(pos2!=link.end()){\n                   auto pp=pos2;\n                   pos2++;\n                   if(pos2!=link.end()){\n                    pv=pos2->second;\n                    link[pos2->first]=max(link[pp->first],(pos2->first-pp->first));\n                    if(pv==pos2->second) break;\n                   }\n                }\n            }\n        }\n        else{\n            int sz=queries[i][2];\n            auto pos1=link.lower_bound(x);\n            if(pos1->first==x){\n                if(link[x]>=sz) ans.push_back(true);\n                else ans.push_back(false);\n            }\n            else{\n                pos1--;\n                if(max(link[pos1->first],(x-pos1->first))>=sz) ans.push_back(true);\n                else ans.push_back(false);\n            }\n        }\n       }\n       return ans; \n    }\n};\n```
['C++']