Sunday, April 3, 2022

📑 3D Printing

Codejam Qualification Round 2022. Task 2

Python Only

T=int(input())
for t in range(T):
    C,M,Y,K=[],[],[],[]
    for i in range(3):
        N=input()
        N=[int(n) for n in N.split()]
        C+=[N[0]]; M+=[N[1]]; Y+=[N[2]]; K+=[N[3]]
    c,m,y,k=min(C),min(M),min(Y),min(K)
    if c+m+y+k<10**6:
        R='IMPOSSIBLE'
    else:
        m=min([m,10**6-c])
        y=min([y,10**6-c-m])
        k=10**6-c-m-y
        R='{} {} {} {}'.format(c,m,y,k)
    print('Case #{}: {}'.format(t+1,R))


No comments:

Post a Comment