Python | Sorted List | Sort the Query and Rooms According to Room Size
First sort the rooms and queries according to room size in decreasing order\nThen process the query one by one after inserting all the rooms with sizes greater 
First sort the rooms and queries according to room size in decreasing order\nThen process the query one by one after inserting all the rooms with sizes greater than or equal to current query\'s room size\n```\nfrom sortedcontainers import SortedList\n\nclass Solution:\n    def closestRoom(self, rooms: List[List[int]], queries: List[List[int]]) -> List[int]:\n        queries = [ (q[1],q[0],i)for i,q in enumerate(queries)]\n        queries.sort(reverse = True)\n        rooms.sort(key = lambda e: (e[1],e[0]), reverse = True)\n        sl = SortedList()\n        res = [0]*len(queries)\n        ri = 0\n        for q in queries:\n            qsz, qid, qi = q\n            while ri < len(rooms) and rooms[ri][1] >= qsz:\n                sl.add(rooms[ri][0])\n                ri += 1\n            if not sl:\n                res[qi] = -1\n                continue\n            idx = sl.bisect_left(qid)\n            if idx == 0:\n                res[qi] = sl[idx]\n            elif idx == len(sl):\n                res[qi] = sl[-1]\n            else:\n                if sl[idx] >= 2*qid - sl[idx-1]:\n                    res[qi] = sl[idx-1]\n                else:\n                    res[qi] = sl[idx]\n        return res\n```
['Python']