<doocs>2371.Minimize Maximum Value in a Grid_1.py
def minScore( grid: List[List[int]]) -> List[List[int]]:
    m, n = len(grid), len(grid[0])
    nums = [(v, i, j) for i, row in enumerate(grid) for j, v in enumerate(row)]
    nums.sort()
    row_max = [0] * m
    col_max = [0] * n
    ans = [[0] * n for _ in range(m)]
    for _, i, j in nums:
        ans[i][j] = max(row_max[i], col_max[j]) + 1
        row_max[i] = col_max[j] = ans[i][j]
    return ans
def sample_funcname ( var_0 : List [ List [ int ] ] ) -> List [ List [ int ] ] :
    var_4 , var_6 = len ( var_0 ) , len ( var_0 [ 0 ] )
    var_12 = [ ( var_7 , var_8 , var_9 ) for var_8 , var_10 in enumerate ( var_0 ) for var_9 , var_7 in enumerate ( var_10 ) ]
    var_12.sort ( )
    var_14 = [ 0 ] * var_4
    var_15 = [ 0 ] * var_6
    var_18 = [ [ 0 ] * var_6 for var_16 in range ( var_4 ) ]
    for var_16 , var_8 , var_9 in var_12 :
        var_18 [ var_8 ] [ var_9 ] = max ( var_14 [ var_8 ] , var_15 [ var_9 ] ) + 1
        var_14 [ var_8 ] = var_15 [ var_9 ] = var_18 [ var_8 ] [ var_9 ]
    return var_18
