C++ | Simple Code | Beats 85.23% of users with C++
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```\nclass Solution {\npublic:\n    int largestSubmatrix(vector<vector<int>>& matrix) {\n        int m=matrix.size(), n=matrix[0].size();\n        int area=count(matrix[0].begin(), matrix[0].end(), 1);\n        for(int i=1;  i<m; i++){\n            #pragma unroll\n            for(int j=0; j<n; j++){\n                if (matrix[i][j]!=0)\n                    matrix[i][j]+=matrix[i-1][j];\n            }\n            auto row=matrix[i];\n            sort(row.begin(), row.end());\n            #pragma unroll\n            for(int i=0; i<n; i++)\n                area=max(area, row[i]*(n-1-i+1));\n        }\n        return area;\n    }\n};\nauto init = []()\n{ \n    ios::sync_with_stdio(0);\n    cin.tie(0);\n    cout.tie(0);\n    return \'c\';\n}();\n```
['C++']