Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions solutions/3DPrinting/python/3DPrinting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#Sanchez Palacios
#Google codejam 2020 3DPrinting
import sys

T = int(input())

for i in range (0,T):

C = []
M = []
Y = []
K = []

for j in range(0,3):
printer = list(input().split(" "))
C.append(int(printer[0]))
M.append(int(printer[1]))
Y.append(int(printer[2]))
K.append(int(printer[3]))

tinta = [min(C),min(M),min(Y),min(K)]

Total = tinta[0] + tinta[1] + tinta[2] + tinta[3]
P = 1000000

if(Total >= 1000000):
res = "\nCase #" + str(i+1) + ": "
z = 0
for i in range (0,4):
if P > tinta[i] and P > 0:
res += str(tinta[i]) + " "
P -= tinta[i]
elif P > 0:
res += str(P) + " "
P -= P
else:
res += " 0 "
z += 1
print(res+"\n")
else:
print("\nCase #" + str(i+1) + ": IMPOSSIBLE \n")
sys.stdout.flush()