Matrix Rearrangements - solving a problem with APL.

Matrix Rearrangements - solving a problem with APL.
Given a NxM matrix, one can pick a single element from each row so that the cost of this operation is the smallest. The cost is defined as the sum of every other element left in a row. For each column containing nonzero elements, an element must be picked so that every other element besides the chosen one must originate from different rows. What is the lowest cost for a given matrix?
Read more →