We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Hello my dear friends.
How can I improve speed of my python code, which seems to do right calculations but it takes too long?
totallist = [int(i) for i in input().split()]
maxtopics = 0
guyslist = []
smarteams = 0
for n in range(0, totallist[0]):
guyslist += [str(input())]
for i in range(0, totallist[0]-1):
for j in range (i+1, totallist[0]):
knowntopics = 0
for q in range (0, totallist[1]):
if int(guyslist[i][q]) or int(guyslist[j][q]):
knowntopics += 1
if knowntopics > maxtopics:
maxtopics = knowntopics
smarteams = 1
elif knowntopics == maxtopics:
smarteams += 1
print (maxtopics)
print (smarteams)
ACM ICPC Team
You are viewing a single comment's thread. Return to all comments →
Hello my dear friends. How can I improve speed of my python code, which seems to do right calculations but it takes too long?