Simple bruteforce solution C++
The constraint is just small, who do you bother to use overkilled weapon like segment tree (ofcouse compression in advance)\n\nclass Solution {\npublic:\n    ve
The constraint is just small, who do you bother to use overkilled weapon like segment tree (ofcouse compression in advance)\n```\nclass Solution {\npublic:\n    vector<int> fallingSquares(vector<vector<int>>& a) {\n        int n = a.size();\n        vector<int> ans(n, 0);\n        for(int i=0; i<n; i++) {\n            ans[i] = a[i][1];\n            int curL = a[i][0];\n            int curR = a[i][1] + curL;\n            for(int j=0; j<i; j++) {\n                int L = a[j][0];\n                int R = L + a[j][1];\n                if (curL < R && curR > L) ans[i] = max(ans[i], a[i][1] + ans[j]);;\n            }\n        }\n        for(int i=1; i<n; i++) ans[i] = max(ans[i], ans[i-1]);\n        return ans;\n    }\n};\n```
[]