🐍 Python solution ✅ || 😼 Beats 92.65% ✨
\n\n\nclass Solution:\n    def matrixSumQueries(self, n: int, queries: list) -> int:\n        rowcol = [n, n]\n        ans = 0\n        seen = [0, 0]\n\n       
![Screenshot_1.png](https://assets.leetcode.com/users/images/727f019d-69ec-4688-a046-3158e25cd366_1723654406.7657878.png)\n\n```\nclass Solution:\n    def matrixSumQueries(self, n: int, queries: list) -> int:\n        rowcol = [n, n]\n        ans = 0\n        seen = [0, 0]\n\n        for t, i, v in reversed(queries):\n            if not seen[t] & (1 << i):\n                seen[t] |= 1 << i\n                ans += v * rowcol[t]\n                rowcol[t ^ 1] -= 1\n\n        return ans\n\n```
['Python3']