-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathACM_ICPC_team.py
49 lines (35 loc) · 881 Bytes
/
ACM_ICPC_team.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the acmTeam function below.
def acmTeam(topic):
maxsub = 0
count = 0
for i in range(n):
for j in range(i,n):
sub = 0
for x,y in zip(topic[i],topic[j]):
if x=='1' or y=='1':
sub+=1
if sub>maxsub:
maxsub = sub
count =1
elif sub == maxsub:
count+=1
return (maxsub,count)
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
nm = input().split()
n = int(nm[0])
m = int(nm[1])
topic = []
for _ in range(n):
topic_item = input()
topic.append(topic_item)
result = acmTeam(topic)
fptr.write('\n'.join(map(str, result)))
fptr.write('\n')
fptr.close()