Problem p02748 (python)

Fixed submission:
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
L = [[int(x) for x in input().split()] for _ in range(M)]

reg = min(a) + min(b)
for x, y, c in L:
    tmp = a[x-1] + b[y-1] - c
    reg = min(reg, tmp)
print(reg)

Buggy submission (verdict: Runtime Error):
import numpy as np


A, B, M = map(int, input().split())
a = list(map(int, input().split()))
a = np.array(a)
b = list(map(int, input().split()))
b = np.array(b)
z = [list(map(int, input().split())) for _ in range(M)]
z = np.array(z)


xx, yy = np.meshgrid(a, b)
xx1 = xx.flatten()
yy1 = yy.flatten()

xxyy = np.c_[xx1, yy1]
mem = xxyy.sum(axis=1)
# mem = list(mem)
mem2 = []
for x, y, c in z:
    mem2.append(a[x - 1] + b[y - 1] - c)
np.append(mem, mem2)


print(min(mem))
# print(mem)

Buggy submission (verdict: Runtime Error):
import numpy as np


A, B, M = map(int, input().split())
a = list(map(int, input().split()))
a = np.array(a)
b = list(map(int, input().split()))
b = np.array(b)
z = [list(map(int, input().split())) for _ in range(M)]
z = np.array(z)


xx, yy = np.meshgrid(a, b)
xx1 = xx.flatten()
yy1 = yy.flatten()

xxyy = np.c_[xx1, yy1]
mem = xxyy.sum(axis=1)
# mem = list(mem)
mem2 = []
for x, y, c in z:
    mem2.append(a[x - 1] + b[y - 1] - c])
np.append(mem, mem2)


print(min(mem))
# print(mem)

Buggy submission (verdict: Runtime Error):
import numpy as np


A, B, M = map(int, input().split())
a = list(map(int, input().split()))
a = np.array(a)
b = list(map(int, input().split()))
b = np.array(b)
z = [list(map(int, input().split())) for _ in range(M)]
z = np.array(z)


xx, yy = np.meshgrid(a, b)
xx1 = xx.flatten()
yy1 = yy.flatten()

xxyy = np.c_[xx1, yy1]
mem = xxyy.sum(axis=1)
# mem = list(mem)

for x, y, c in z:
    # mem.append(a[x - 1] + b[y - 1] - c)
    np.append(mem, [a[x - 1] + b[y - 1] - c])


print(min(mem))
# print(mem)

Buggy submission (verdict: Runtime Error):
import numpy as np


A, B, M = map(int, input().split())
a = list(map(int, input().split()))
a = np.array(a)
b = list(map(int, input().split()))
b = np.array(b)
z = [list(map(int, input().split())) for _ in range(M)]
z = np.array(z)


xx, yy = np.meshgrid(a, b)
xx1 = xx.flatten()
yy1 = yy.flatten()

xxyy = np.c_[xx1, yy1]
mem = xxyy.sum(axis=1)
# mem = list(mem)

for x, y, c in z:
    # mem.append(a[x - 1] + b[y - 1] - c)
    np.append(mem, (a[x - 1] + b[y - 1] - c))


print(min(mem))
# print(mem)

Buggy submission (verdict: Runtime Error):
import numpy as np


A, B, M = map(int, input().split())
a = list(map(int, input().split()))
a = np.array(a)
b = list(map(int, input().split()))
b = np.array(b)
z = [list(map(int, input().split())) for _ in range(M)]
z = np.array(z)


xx, yy = np.meshgrid(a, b)
xx1 = xx.flatten()
yy1 = yy.flatten()

xxyy = np.c_[xx1, yy1]
mem = xxyy.sum(axis=1)
mem = list(mem)

for x, y, c in z:
    mem.append(a[x - 1] + b[y - 1] - c)
   

print(min(mem))

Buggy submission (verdict: Runtime Error):
import numpy as np


A, B, M = map(int, input().split())
a = list(map(int, input().split()))
a = np.array(a)
b = list(map(int, input().split()))
b = np.array(b)
z = [list(map(int, input().split())) for _ in range(M)]
z = np.array(z)


# for i in range(len(a)):
#     for j in range(len(b)):
#         mem.append(a[i] + b[j])

xx, yy = np.meshgrid(a, b)
xx1 = xx.flatten()
yy1 = yy.flatten()

xxyy = np.c_[xx1, yy1]
mem = xxyy.sum(axis=1)
mem = list(mem)

for x, y, c in z:
    mem.append(a[x - 1] + b[y - 1] - c)
    # np.append(mem, (a[x - 1] + b[y - 1] - c))

print(min(mem))
# print(mem)