Untitled

mail@pastecode.io avatar
unknown
python
8 months ago
604 B
2
Indexable
Never
n, m = [int(i) for i in input().split()]

matrix = []


for row in range(n):
    matrix.append([int(i) for i in input().split()])

cnt = int(input())


for _ in range(cnt):
    commands = [int(i) for i in input().split()]

    if commands[0] == 1:
        matrix[commands[1] - 1][commands[2] - 1] += commands[3]
    else:
        rl = commands[1]
        cl = commands[2]
        rr = commands[3]
        cr = commands[4]

        ans = -float('inf')
        for row in range(rl - 1, rr):
            for col in range(cl - 1, cr):
                ans = max(matrix[row][col], ans)

        print(ans)




Leave a Comment