Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. You are given a list of people who are attending ACM-ICPC World Finals. Each of them are either well versed in a topic or they are not. Find out the maximum number of topics a 2-person team can know. And also find out how many teams can know that maximum number of topics.
  2.  
  3. Note Suppose a, b, and c are three different people, then (a,b) and (b,c) are counted as two different teams.
  4.  
  5. Input Format
  6.  
  7. The first line contains two integers, and , separated by a single space, where represents the number of people, and represents the number of topics. lines follow.
  8. Each line contains a binary string of length . If the th line's th character is , then the th person knows the th topic; otherwise, he doesn't know the topic.
  9.  
  10. Constraints
  11.  
  12.  
  13. Output Format
  14.  
  15. On the first line, print the maximum number of topics a 2-person team can know.
  16. On the second line, print the number of 2-person teams that can know the maximum number of topics.
  17.  
  18. Sample Input
  19.  
  20. 4 5
  21. 10101
  22. 11100
  23. 11010
  24. 00101
  25. Sample Output
  26.  
  27. 5
  28. 2
  29. Explanation
  30.  
  31. (1, 3) and (3, 4) know all the 5 topics. So the maximal topics a 2-person team knows is 5, and only 2 teams can achieve this.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement