Problem p03078 (python)

Fixed submission:
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = []
for i in range(x):
    for j in range(y):
        ans.append(a[i]+b[j])
ans.sort(reverse=True)
ans = ans[:k]
ans2 = []
for i in range(len(ans)):
    for j in range(z):
        ans2.append(ans[i]+c[j])
ans2.sort(reverse=True)
for i in range(k):
    print(ans2[i])

Buggy submission (verdict: Runtime Error):
import numpy as np
x,y,z,k = map(int,input().split())
a = np.array(list(map(int,input().split())))
b = np.array(list(map(int,input().split())))
c = np.array(list(map(int,input().split())))
a2,b2,c2 = np.meshgrid(a,b,c)
abc = np.c_[a2.flatten(),b2.flatten(),c2.flatten()]
ans = []
for i in range(x*y*z):
    ans.append(sum(abc[i]))
ans = np.sort(ans)[::-1]
for i in range(k):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import numpy as np
x,y,z,k = map(int,input().split())
a = np.array(list(map(int,input().split())))
b = np.array(list(map(int,input().split())))
c = np.array(list(map(int,input().split())))
ans = []
for i in range(x):
    for j in range(y):
        for l in range(z):
            ans.append(a[i] + b[j] + c[l])
ans = np.sort(ans)[::-1]
for i in range(k):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import numpy as np
x,y,z,k = map(int,input().split())
a = np.array(list(map(int,input().split())))
b = np.array(list(map(int,input().split())))
c = np.array(list(map(int,input().split())))
a2,b2,c2 = np.meshgrid(a,b,c)
abc = np.c_[a2.flatten(),b2.flatten(),c2.flatten()]
ans = []
for i in range(x*y*z):
    ans.append(sum(abc[i]))
ans = np.sort(ans)[::-1]
for i in range(k):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import numpy as np
x,y,z,k = map(int,input().split())
a = np.array(list(map(int,input().split())))
b = np.array(list(map(int,input().split())))
c = np.array(list(map(int,input().split())))
a2,b2,c2 = np.meshgrid(a,b,c)
abc = np.c_[a2.flatten(),b2.flatten(),c2.flatten()]
ans = np.zeros(x*y*z,dtype=int)
for i in range(x*y*z):
    ans[i] = sum(abc[i])
ans = np.sort(ans)[::-1]
for i in range(k):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import numpy as np
x,y,z,k = map(int,input().split())
a = np.array(list(map(int, input().split())))
b = np.array(list(map(int, input().split())))
c = np.array(list(map(int, input().split())))
ans = []
for i in range(x):
    for j in range(y):
        for l in range(z):
            ans.append(a[i] + b[j] + c[l])
ans.sort(reverse = True)
for i in range(k):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import numpy as np
x,y,z,k = map(int,input().split())
a = np.array(list(map(int, input().split())))
b = np.array(list(map(int, input().split())))
c = np.array(list(map(int, input().split())))
aa,bb,cc = np.meshgrid(a,b,c)
aaa = aa.flatten()
bbb = bb.flatten()
ccc = cc.flatten()
abc = np.c_[aaa,bbb,ccc]
ans = np.sum(abc,axis=1)
ans = list(ans)
ans.sort(reverse = True)
for i in range(k):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
import numpy as np
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a = np.array(a)
b = np.array(b)
c = np.array(c)
aa,bb,cc = np.meshgrid(a,b,c)
abc = np.c_[aa.flatten(),bb.flatten(),cc.flatten()]
ans = np.sum(abc,axis=1)
ans = list(ans)
ans.sort(reverse = True)
for i in range(k):
    print(ans[i])