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.
I did speed it up a little bit, but still too slow:
totallist = [int(i) for i in input().split()]
maxtopics = 0
guyslist = []
smarteams = 0
for n in range(0, totallist[0]):
line = list(str(input()))
guyslist += [line]
guyslist = [[int(y) for y in x] for x in guyslist]
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 (guyslist[i][q]) or (guyslist[j][q]):
knowntopics += 1
if knowntopics > maxtopics:
maxtopics = knowntopics
smarteams = 1
elif knowntopics == maxtopics:
smarteams += 1
print (maxtopics)
print (smarteams)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
ACM ICPC Team
You are viewing a single comment's thread. Return to all comments →
I did speed it up a little bit, but still too slow: