The question in short is: You are given a matrix consisting of digits zero and one, its size is n × m. You are allowed to rearrange its rows. What is the maximum area of the submatrix that only consists of ones and can be obtained in the given problem by the described operations?
Problem link: http://codeforces.me/contest/375/problem/B
Tutorial Link: http://codeforces.me/blog/entry/10084
I am having problem understanding the solution. It uses a right[i][j]=number of continuous 1s to the right of input[j][i] and then sorts the right matrix along the columns. I'm not sure how this works. Does sorting according to columns arrives at a particular permutation of rows? How does this work?