TOPIC

Runtime Error ??

Tester asked 2 years ago

while True:
  x, y, preco = [int(i) for i in input().split()]

  if x == y and y == preco and preco == 0:
    break
  m = []
  for i in range(y):
    m += [[0]*x]

  casos_t = int(input())

  for i in range(casos_t):
    inp = input().split()
    if inp[0] == 'A':
      x1 = int(inp[2])
      y1 = int(inp[3])
      qtd = int(inp[1])
      m[x1][y1] += qtd

    if inp[0] == 'P':
      x1 = int(inp[1])
      y1 = int(inp[2])
      x2 = int(inp[3])
      y2 = int(inp[4])
      if y1 > y2:
        aux = y1
        y1 = y2
        y2 = aux

      if x1 < x2:
        aux = x1
        x1 = x2
        x2 = aux

      vf = 0
      for j in range(x1, x2+1):
        for l in range(y1, y2+1):
          vf += m[j][l]

      print(vf*preco)

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.