I'm working on an question that's part of the CCC(question: https://dmoj.ca/problem/ccc18s2) I have my code, but it doesnt work all the time. When I input my code into the online grader (which can be found on the linked page) I only get 3/15 marks. All the inputs I put in myself seem to work out, but the grader seems to be different.
My code:
lowest_val = []
flower=[]
n = int(input())
for i in range(0,n):
flower.append(input().split(" "))
lowest_val.append(flower[0][0])
lowest_val.append(flower[0][n-1])
lowest_val.append(flower[n-1][0])
lowest_val.append(flower[n-1][n-1])
while True:
if flower[0][0] == min(lowest_val):
for row in flower:
for i in row:
print(i, end=" ")
print()
break
flower = list(zip(*flower[::-1]))
To answer this question, I can simply check if the top left corner is the smallest corner, so flower[0][0]
must be the smallest corner.
min()
looks for the smallest number out of the 4 corner that I added to the list lowest_val
.
I cant find a test where this fails, and that might be my biggest problem. On dmoj (the online grader) all it does is say I got part of the question wrong.
Here is a test case that fails with your code:
Can you find out why it fails?