-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathacm_icpc_team_problem.py
50 lines (37 loc) · 1.32 KB
/
acm_icpc_team_problem.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 re
import sys
# Complete the acmTeam function below.
def acmTeam(topics):
final_max_number_of_topics = 0
number_of_ways_to_form = 0
for first_counter in range(0,len(topics)):
for second_coutner in range(first_counter+1,len(topics)):
initial_max_number_of_topics = 0
for index in range(0, len(topics[first_counter])):
if topics[first_counter][index] == "1" or topics[second_coutner][index] == "1":
initial_max_number_of_topics += 1
if initial_max_number_of_topics > final_max_number_of_topics:
final_max_number_of_topics = initial_max_number_of_topics
number_of_ways_to_form = 0
if initial_max_number_of_topics == final_max_number_of_topics:
number_of_ways_to_form += 1
answer = []
answer.append(final_max_number_of_topics)
answer.append(int(number_of_ways_to_form))
return answer
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()