I start with a matrix, lets say 4x4. So I want the N top scores, with the sum of one element of each row. For example:
M[4][4] = {
(13, 8, 5, 3),
(11, 9, 7, 4),
( 8, 6, 2, 1),
( 6, 5, 4, 1)
}
So the top 6 scores of that matrix will be:
top_scores = {
(13, 11, 8, 6), // 38
(13, 11, 8, 5), // 37
(13, 11, 6, 6), // 36
(13, 11, 8, 4), // 36
(13, 9, 8, 6), // 36
(13, 11, 6, 5), // 35
}
What I want is to get the best scores directly, not calculating all the possible combinations and picking the top ones, because the matrix can be much bigger. I've tried to solve it with different approaches, but I failed in all of them.