1 / 3
Jul 2014

Hi..I have written a very simple code for the problem fake tournament in which i append all the inputs into a list.Then i count the number of zeros in the list which is equal to the number of players for whom the tournament can be set.I used python 2.7.But i am getting time limit exceeded.why??

  • created

    Jul '14
  • last reply

    Jul '14
  • 2

    replies

  • 334

    views

  • 2

    users

It's tough to tell without actually seeing your code. Please post it using code tags.

def a():
	num = [] #create a list
	i = 0
	x = int(raw_input())
	for i in range(0, x):
		s = (raw_input())
		mynums = map(int, s.split()) #to take multiple inputs in a single line
		num.append(mynums) #append all the inputs into the list num
	flag = num.count([0]) #count the number of zeros as that would be equal to the number of players for whom tournament could be set
	print flag
y = int(raw_input())
for j in range(0, y):
	a()