Can anyone explain the idea behind the editorial of Codeforces Question Maximum Submatrices 2

Can anyone help me in solving Maximum Submatrix2

Thank you :slight_smile:


Array will be no of 1 in each row

I have already solved this a year back. How my question is related to this. My question involves shuffling rows and calculate max area. If there is no shuffling then obviously the question would be finding the max area rectangle which uses the largest rectangular Histogram. I though of using dp, taking that row and not taking. But that would increase the time complexity. I saw the editorial but unable to get it. It would be better if someone explain the editorial.