You are given a list of \$N\$ 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.
Note Suppose \$a\$, \$b\$, and \$c\$ are three different people, then \$(a,b)\$ and \$(b,c)\$ are counted as two different teams.
Input Format
The first line contains two integers, \$N\$ and \$M\$, separated by a single space, where \$N\$ represents the number of people, and \$M\$ represents the number of topics. \$N\$ lines follow. Each line contains a binary string of length \$M\$ If the \$i\$'th line's j'th character is 1, then the i'th person knows the \$j\$'th topic; otherwise, he doesn't know the topic.
Constraints
\$2 ≤ N ≤ 500\$
\$1 ≤ M ≤ 500\$
Output Format
On the first line, print the maximum number of topics a 2-person team can know. On the second line, print the number of 2-person teams that can know the maximum number of topics.
Imports System
Module Solution
Public Sub Main()
Dim input As String() = Console.Readline().Split(" ")
Dim people As Integer = CInt(input(0))
Dim topics As Integer = CInt(input(1))
Dim peopleKnowledge(people-1)() As Char
Dim maxScore As Integer = 0
Dim teamsWithMaxScore As Integer = 0
Dim score As Integer = 0
For i As Integer = 0 To people-1
peopleKnowledge(i) = Console.ReadLine().ToCharArray()
Next i
For i As Integer = 0 to people-2
For j As Integer = i+1 To people-1
score = GetTeamScore(peopleKnowledge(i),peopleKnowledge(j),topics)
If score > maxScore Then
maxScore = score
teamsWithMaxScore = 1
ElseIf score = maxScore Then
teamsWithMaxScore += 1
End If
Next j
Next i
Console.WriteLine(maxScore)
Console.WriteLine(teamsWithMaxScore)
End Sub
Private Function GetTeamScore(m1 As Char(),m2 As Char(), topics As Integer) As Integer
Dim score As Integer = 0
For i as Integer = 0 to topics-1
If m1(i).Equals("1"c) Or m2(i).Equals("1"c) Then
score += 1
End If
Next i
Return score
End Function
End Module
Trying to become acquainted with VB.NET so I welcome any and all suggestions. This solution executes in 0.61s with \$N = M = 500\$; would love to know about any performance gains.