C++ beats 100%.
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n#define pii pair<int, int>\n#define piii pair<int, pii>\n#define f first\n#define s second\n\nclass Solution {\npublic:\n    int m,n;\n    bool isValid(int x, int y){\n        return min(x,y) >= 0 && x < m && y < n;\n    }\n\n    int trapRainWater(vector<vector<int>>& matrix) {\n        m = matrix.size();\n        n = matrix[0].size();\n\n        vector<vector<bool>> visited(m+1, vector<bool>(n+1, false));\n        priority_queue<piii, vector<piii>, greater<piii>> pq;\n        int dx[4] = {1, -1, 0, 0};\n        int dy[4] = {0, 0, 1, -1};\n\n        for (int i = 0; i < m; i++){\n            for (int j = 0; j < n; j++){\n                if (i == 0 || i == m-1 || j == 0 || j == n-1){\n                    pq.push({matrix[i][j], {i, j}});\n                }\n            }\n        }\n\n        int ans = 0;\n        while(!pq.empty()){\n            int i = pq.top().s.f;\n            int j = pq.top().s.s;\n            int h = pq.top().f;\n            pq.pop();\n\n            if (visited[i][j]) continue;\n            visited[i][j] = 1;\n            ans += h - matrix[i][j];\n\n            for (int k = 0; k < 4; k++){\n                int nx = i + dx[k];\n                int ny = j + dy[k];\n                if (isValid(nx, ny) && !visited[nx][ny]){\n                    pq.push({max(h, matrix[nx][ny]), {nx, ny}});\n                }\n            }\n        }\n\n        return ans;\n    }\n};\n```
['C++']