Why it says "WA test case skipped" when I runt it? It's fine on my machine. Am
I not parsing the input correctly? What's wrong here?
this is from 2018 Burger Optimization exercises. It gives me the same error for
all exercises.
from itertools import permutations
def burger():
output = {}
for repeat in range(1, int(input())+ 1):
ingredients = int(input())
distance_ingredients = [int(x) for x in input().split()]
totpermutations = permutations(distance_ingredients)
value = 999999
if len(distance_ingredients) > 4:
for distance in totpermutations:
value = min(value, (distance[0] - 0) ** 2 + (distance[1] - 1)
** 2 + sum(
[(i - 2) ** 2 for i in distance[2:-2]]) + (distance[-2] -
1) ** 2 + (distance[-1] - 0) ** 2)
if len(distance_ingredients) == 4:
for distance in totpermutations:
value = min(value, (distance[0] - 0) ** 2 + (distance[1] - 1)
** 2 + (distance[-2] - 1) ** 2 + (
distance[-1] - 0) ** 2)
if len(distance_ingredients) == 3:
for distance in totpermutations:
value = min(value, (distance[0] - 0) ** 2 + (distance[1] - 1)
** 2 + (distance[-1] - 0) ** 2)
if len(distance_ingredients) == 2:
for distance in totpermutations:
value = min(value, (distance[0] - 0) ** 2 + (distance[1] - 1)
** 2)
if len(distance_ingredients) == 1:
for distance in totpermutations:
value = min(value, (distance[0] - 0) ** 2)
output[repeat] = "Case #{}: {}".format(repeat, value)
# print("Case #{}: {}".format(repeat, value))
return "\n".join(output.values())
# print(burger())
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/5417696a-acd0-4c97-980c-462e51e7fc03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.