Process in reverse
\nclass Solution:\n    def matrixSumQueries(self, n: int, queries: List[List[int]]) -> int:\n        q = len(queries)\n        r = set()\n        c = set()\n   
```\nclass Solution:\n    def matrixSumQueries(self, n: int, queries: List[List[int]]) -> int:\n        q = len(queries)\n        r = set()\n        c = set()\n        res = 0\n        for i in range(q - 1, -1, -1):\n            if queries[i][0] == 0 and queries[i][1] not in r:\n                res += (n - len(c)) * queries[i][2]\n                r.add(queries[i][1])\n            if queries[i][0] == 1 and queries[i][1] not in c:\n                res += (n - len(r)) * queries[i][2]\n                c.add(queries[i][1])\n \xA0 \xA0 \xA0 \xA0return res \n```
[]