Submission #4864733

Source Code Expand

Copy
```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.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

"""
max_b = max(B)
max_c = max(C)
"""

summs_ab = []
summs = []
for a in A:
for b in B:
summs_ab.append(a+b)
summs_ab.sort(reverse=True)
summs_ab = summs_ab[:min(3001, X*Y*Z+1)]

for c in C:
for sab in summs_ab:
summs.append(sab+c)
summs.sort(reverse=True)
"""
for a in A[:K]:
if len(summs) >= K and a + max_b + max_c < summs[K-1]:
break

for b in B[:K]:
if len(summs) >= K and a + b + max_c < summs[K-1]:
break

for c in C[:K]:
summ = a + b + c
if len(summs) >= K:
min_sum = summs[K-1]
if summ < min_sum:
break
summs.append(summ)
summs = merge_sort(summs)
summs.reverse()
"""
for i in range(K):
print(summs[i])```

#### Submission Info

Submission Time 2019-04-06 23:04:44+0900 D - Cake 123 showyou41 Python3 (3.4.3) 0 1049 Byte TLE

#### Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt
All 0 / 400 in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, in22.txt, in23.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
in01.txt 1566 ms 159724 KB
in02.txt 1537 ms 159288 KB
in03.txt 1699 ms 159480 KB
in04.txt 1520 ms 159220 KB
in05.txt 1526 ms 160852 KB
in06.txt 1509 ms 159344 KB
in07.txt 890 ms 131812 KB
in08.txt 871 ms 137360 KB
in09.txt 1420 ms 135672 KB
in10.txt 656 ms 159620 KB
in11.txt 666 ms 159156 KB
in12.txt 672 ms 159644 KB
in13.txt 748 ms 160484 KB
in14.txt 696 ms 159164 KB
in15.txt 699 ms 145612 KB
in16.txt 17 ms 3064 KB
in17.txt 17 ms 3064 KB
in18.txt 953 ms 159940 KB
in19.txt 719 ms 159204 KB
in20.txt 1654 ms 159376 KB
in21.txt 1311 ms 156708 KB
in22.txt 879 ms 160272 KB
in23.txt
s1.txt 17 ms 3064 KB
s2.txt 17 ms 3064 KB
s3.txt 17 ms 3064 KB