문제

this is another algorithms problem related to dynamic programming

Here is the problem :

find the minimum sum of the given matrix such that select one in each row and column

For example :

3 4 2

8 9 1

7 9 5

the minimum one : 4 + 1 + 7

I think the solution is network flow (max flow/min cut) but I think it shouldn't be as hard as it is

My solution: seperate to n list[column], column1, column2 ... column n

then start point (S) -> column1 -> column2 -> ... -> column n -> (E) end point and implement max flow/min cut

도움이 되었습니까?

해결책

This is the Assignment Problem which can be considered a special case of minimum weight perfect matching in graphs. The classic way to solve the Assignment Problem is to use the Hungarian Algorithm.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top