#T53. 橱窗布置

橱窗布置

Description

Suppose we want to arrange the window display of a flower shop in the most aesthetically pleasing way. There are FF bouquets of flowers, each of a different variety. At the same time, there are at least as many vases, arranged in a row in a fixed order, numbered sequentially from left to right as 11 to VV, where VV is the number of vases. Vase number 11 is on the far left, and vase number VV is on the far right. The bouquets can be moved, and each bouquet is uniquely identified by an integer from 11 to FF. The integer identifying the bouquet determines the order in which the bouquets are placed in the vases—that is, if i<ji < j, then bouquet ii must be placed in a vase to the left of bouquet jj.

For example, suppose the azalea is identified by number 11, the begonia by number 22, and the carnation by number 33. All bouquets must be placed in the vases in the order of their identifiers. That is, the azalea must be placed in a vase to the left of the begonia, and the begonia must be placed in a vase to the left of the carnation. If the number of vases is greater than the number of bouquets, the extra vases must remain empty, meaning each vase can hold at most one bouquet.

Each vase also differs in shape and color, so placing different bouquets in different vases will produce varying aesthetic effects, represented by an aesthetic value (an integer). The aesthetic value of an empty vase is 00. In the example above, the aesthetic values of different vase-bouquet pairings can be represented in the following table.

According to the table, placing the azalea in vase 22 would look very beautiful, but placing it in vase 44 would look very unattractive.

To achieve the best aesthetic effect, the bouquets must be arranged to maximize the total aesthetic value while maintaining the order of the bouquets. If there are multiple arrangements with the maximum aesthetic value, any one of them can be output.

The problem data satisfies the following conditions:
1F1001 ≤ F ≤ 100, where FF is the number of bouquets, numbered from 11 to FF.
FV100F ≤ V ≤ 100, where VV is the number of vases.
50Aij50-50 ≤ A_{ij} ≤ 50, where AijA_{ij} is the aesthetic value of placing bouquet ii in vase jj.

Input Format

The first line contains two numbers: FF, VV.
The subsequent FF lines each contain VV integers, where AijA_{ij} is the jj-th number in the (i+1)(i+1)-th line of the input file.

Output Format

The first line is the aesthetic value produced by the program's arrangement.
The second line must contain FF numbers representing the arrangement, where the KK-th number indicates the vase number in which bouquet KK is placed.

Vase 1   Vase 2   Vase 3   Vase 4   Vase 5  
Azalea   7        23       -5       -24      16  
Begonia  5        21       -4       10       23  
Carnation -21      5        -4       -20      20  
3 5 
7 23 –5 –24 16
5 21 -4 10 23
-21 5 -4 -20 20


53 
2 4 5