Hi,
I coded solution for https://www.codechef.com/problems/COOK82A using python. And all test cases seems to work perfectly fine in IDE. However, on submission my code is failing. I am suspecting it to be an issue with output. Can someone please help in this regard?
Here is my code…
def accept_input():
no_of_test_cases= int(input())
if no_of_test_cases>500:
exit(10)
teamBarcelona = []
teamMalaga = []
teamRealMadrid = []
teamEibar = []
result = []
def whereDoILand(ip):
print(ip)
if ip[0] == "Barcelona" and int(ip[1])<=20:
teamBarcelona.append(ip)
elif ip[0] == "Malaga" and int(ip[1])<=20:
teamMalaga.append(ip)
elif ip[0] == "RealMadrid" and int(ip[1])<=20:
teamRealMadrid.append(ip)
elif ip[0] == "Eibar" and int(ip[1])<=20:
teamEibar.append(ip)
def whoWonTheGame(idx):
if int(teamRealMadrid[i][1])<int(teamMalaga[i][1]) and int(teamBarcelona[i][1])>int(teamEibar[i][1]):
result.append("Barcelona")
else:result.append("RealMadrid")
for i in range(0,no_of_test_cases):
ip = input()
whereDoILand(ip.split(" "))
ip = input()
whereDoILand(ip.split(" "))
ip = input()
whereDoILand(ip.split(" "))
ip = input()
whereDoILand(ip.split(" "))
for i in range(0,no_of_test_cases):
whoWonTheGame(i)
return result
result=accept_input()
for winner in result:
print(winner)