-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathACM ICPC Team
More file actions
53 lines (40 loc) · 992 Bytes
/
ACM ICPC Team
File metadata and controls
53 lines (40 loc) · 992 Bytes
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
50
51
52
53
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import Counter
# Complete the acmTeam function below.
def acmTeam(topic):
lst = []
for i in range(0,len(topic)):
for j in range(i+1,len(topic)):
res = 0
for k in range(0,len(topic[i])):
if topic[i][k]=='1' or topic[j][k]=='1':
res += 1
lst.append(res)
maxi = 0
count = 0
for i in lst:
if i>maxi:
count = 1
maxi = i
elif i==maxi:
count += 1
res = [maxi,count]
return res
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()