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.
fromcollectionsimportCounterfromitertoolsimportcombinationsdefacmTeam(topic):c=Counter()#we could use dict, but Counter has a better name ;)fortincombinations(topic,2):c[bin(int(t[0],2)|int(t[1],2)).count('1')]+=1winner=max(c.keys())returnwinner,c[winner]
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 →
Just a litlle simpler to read and faster to run: