C++ simple solution without a segment tree
Code\n\nclass Solution {\npublic:\n    vector<bool> getResults(vector<vector<int>>& queries) {\n        int maxX = 5 * 1E4 + 1;\n\n        set<int> obt;\n      
# Code\n```\nclass Solution {\npublic:\n    vector<bool> getResults(vector<vector<int>>& queries) {\n        int maxX = 5 * 1E4 + 1;\n\n        set<int> obt;\n        map<int, set<int>> dist;\n        vector<bool> ans;\n\n        obt.insert(0);\n        obt.insert(maxX);\n        dist[maxX].insert(0);\n\n        for(auto q : queries) {\n            if (q[0] == 1) {\n                auto right = obt.lower_bound(q[1]);\n                auto left = right;\n                left--;\n\n                int leftVal = *left;\n                int rightVal = *right;\n\n                dist[q[1] - leftVal].insert(leftVal);\n                dist[rightVal - q[1]].insert(q[1]);\n\n                if (dist[rightVal - leftVal].size() == 1) {\n                    dist.erase(rightVal - leftVal);\n                } else {\n                    dist[rightVal - leftVal].erase(leftVal);\n                }\n                obt.insert(q[1]);\n            } else {\n                bool exist = false;\n                for (auto it = dist.lower_bound(q[2]); it != dist.end(); it++) {\n                    if (*(it->second.begin()) + q[2] <= q[1]) {\n                        exist = true;\n                        break;\n                    }\n                }\n                ans.push_back(exist);\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']