Skip to content

Commit ee64563

Browse files
authored
Create ACM_ICPC_Team.py
1 parent 7c82fa1 commit ee64563

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

ACM_ICPC_Team.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/python3
2+
3+
import itertools
4+
5+
N,M = map(int,input().strip().split())
6+
knowledge=[]
7+
for i in range(N):
8+
knowledge.append(int(input(),2))
9+
mx = -float('inf')
10+
teams=0
11+
for p1,p2 in itertools.combinations(range(N),2):
12+
combined_topics = bin(knowledge[p1]|knowledge[p2]).count('1')
13+
if (combined_topics==mx):
14+
teams+=1
15+
elif (combined_topics>mx):
16+
mx = combined_topics
17+
teams=1
18+
19+
print(mx,teams,sep='\n')

0 commit comments

Comments
 (0)