[Python 3] Aggregate sorted list, detailed explanation (2080 ms)
```\nclass Solution:\n    def closestRoom(self, rooms: List[List[int]], queries: List[List[int]]) -> List[int]:\n        ans = [0] * len(queries)\n        \n   
```\nclass Solution:\n    def closestRoom(self, rooms: List[List[int]], queries: List[List[int]]) -> List[int]:\n        ans = [0] * len(queries)\n        \n        # sort queries to handle largest size queries first\n        q = deque(sorted([(size, room, i) for i, (room, size) in enumerate(queries)], key=lambda a: (-a[0], a[1], a[2])))\n\n        # sort rooms by descending size\n        rooms = deque(sorted(rooms, key=lambda x: -x[1]))\n\n        # current available room ids\n        cands = []\n        \n        \n        while q:\n            size, room, i = q.popleft()\n            # add room ids to candidates as long as top of room size meet the requirements\n            while rooms and rooms[0][1] >= size:\n                bisect.insort(cands, rooms.popleft()[0])\n                    \n            # if no room size available, return -1\n            if not cands: ans[i] = -1\n                \n            # else use bisect to find optimal room ids\n            else:\n                loc = bisect.bisect_left(cands, room)\n                if loc == 0: ans[i] = cands[loc]\n                elif loc == len(cands): ans[i] = cands[-1]\n                else: ans[i] = cands[loc - 1] if room - cands[loc - 1] <= cands[loc] - room else cands[loc]\n        \n        return ans
['Python', 'Python3']