Mbpp/721

❌ 均未通过 Base: FAIL Plus: FAIL
测试评估
指标结果
Base 测试FAIL
Plus 测试FAIL
代码长度532 字符
模型生成的代码 (532 字符)
def maxAverageOfPath(matrix):
    """
    Given a square matrix of size N*N, find a path from the top-left cell to the
    bottom-right cell moving only right or down that yields the maximum average cost.
    Since the number of cells visited on any such path is always (2*N - 1),
    maximizing the average is equivalent to maximizing the total sum.
    """
    if not matrix or not matrix[0]:
        return 0.0
    n = len(matrix)
    # dp[i][j] will hold the maximum sum to reach cell (i, j)
    dp = [[0] * n for _ in range(n)]
Base 失败测试用例
  • [[[1, 2, 3], [6, 5, 4], [7, 3, 9]]]
Plus 失败测试用例
  • [[[0, 0, 0], [0, 0, 0], [0, 0, 0]]]