You are viewing a single comment's thread. Return to all comments →
max_subject = 0 max_team = 0 for first_i in range(len(people)): for second_i in range(first_i + 1, len(people)): first_subject = people[first_i] second_subject = people[second_i] i_k = int(first_subject, 2) i_j = int(second_subject, 2) current_max_sub = bin(i_k | i_j)[2:].count("1") if current_max_sub > max_subject: max_subject = current_max_sub max_team = 1 elif current_max_sub == max_subject: max_team += 1 return [max_subject, max_team]
*
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 →
Using bitwise "|" and Binary is way more better to find max subject
*