Kakuro Extension
The original riddle is a very interesting game. Each blank row or column is called a back. Each return corresponds to an integer sum, and sum is the sum of the returned values. You can only enter the nine numbers (1-9) in the blank box and cannot repeat each time. The black color is empty, and there is a number lattice. The lower-left corner indicates the column's sum, and the upper-right corner indicates the sum of rows. The following figure is displayed.
However, this question is not the original riddle. It is a little less rule than the original riddle, that is, the numbers displayed in each session can be repeated. Here is an N * m graph for you to fill in.
I have read this question, but I don't have many ideas. I can refer to the idea of solving the report, which can be done using network streams. The blank space is used as the node. For example, if the stream is inbound from the left, outbound from the top, inbound capacity is the row sum, outbound capacity is the column sum, and the remaining capacity remains unchanged. Find the maximum stream that is satisfied. Because there are upper and lower limits on traffic, you can reduce each number by 1, and the entered number range is 0-8, you can use a pure network flow. And then add it.
Graph creation:
There are four types of points:
1. Construct Source Vertex S, sink vertex t
2. There is a grid of rows and such nodes are set to
3. Blank Space, set to B
4. A grid with columns and columns is set to C.
You can create an edge:
1. <S, A> capacity and row and
2. <A, B> the capacity is 8
3. <B, c> the capacity is 8
4. <C, T> the capacity is column and
Of course, the reverse side capacity is set to 0.