C++ beat 100%
```\n    vector closestRoom(vector>& rooms, vector>& queries) {\n        set ids;\n        sort(rooms.begin(), rooms.end(), {return a[1] > b[1];});\n        pri
```\n    vector<int> closestRoom(vector<vector<int>>& rooms, vector<vector<int>>& queries) {\n        set<int> ids;\n        sort(rooms.begin(), rooms.end(), [](auto& a, auto& b){return a[1] > b[1];});\n        priority_queue<tuple<int,int,int>> queryQ;\n        const int n = queries.size();\n        vector<int> res(n, -1);\n        for(int i=0;i<queries.size();i++){\n            int preferId = queries[i][0];\n            int minSize = queries[i][1];\n            queryQ.emplace(minSize, preferId, i);\n        }\n        \n        auto it = rooms.begin();\n        while(!queryQ.empty()){\n            auto [minSize, preferId, i] = queryQ.top(); queryQ.pop();\n            while(it != rooms.end() && it->at(1)>= minSize){\n                ids.insert(it->at(0));\n                it++;\n            }\n            \n            auto it2 = ids.lower_bound(preferId);\n            int ans = -1, minDis = 1e9;\n            if(it2 != ids.end()){\n                ans = *it2;\n                minDis = abs(*it2 - preferId);\n            }\n            if(it2 != ids.begin()){\n                auto pre = *prev(it2);\n                if(preferId - pre <= minDis)\n                    ans = pre;\n            }\n            res[i] = ans;\n        }\n        return res;\n    }
[]