Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Google Hash Code Solution of qualification round of year 2020
maxp, nop, = list(map(int,input().split()))
pizza = list(map(int,input().split()))
count = 0
while sum(pizza) > maxp:
diff = sum(pizza) - maxp
data = pizza[min(range(len(pizza)), key=lambda j:abs(pizza[j]-diff))]
pizza[pizza.index(data)] = 0
count = count + 1
for i in range(len(pizza)):
if pizza[i] != 0:
print(str(i), end="")
print(" ", end="")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.