#B4125. Knowledge Contest Winner
Knowledge Contest Winner
Knowledge Contest Winner
A class of students are arranged in a matrix of \(n\) rows and \(m\) columns. The student in the \(i\)th row and \(j\)th column has a knowledge level \(a_{i,j}\). The class will hold a knowledge contest comprised of two rounds:
Round 1 (Team Contest): For each column, compute the total knowledge level by summing the knowledge levels of all students in that column. The column with the highest total wins. In the event of a tie (i.e. more than one column has the same maximum total), the column that is the farthest to the right wins.
Round 2 (Individual Contest): Among the students in the winning column from Round 1, select those with the highest individual knowledge level. These students are declared the final winners.
Your task is to compute the highest knowledge level among the final winners and count how many students share that knowledge level.
Note: All formulas are in \(\LaTeX\) format.
inputFormat
The first line contains two integers \(n\) and \(m\) (the number of rows and columns respectively).
Each of the next \(n\) lines contains \(m\) space-separated integers. The \(j\)th integer in the \(i\)th line represents \(a_{i,j}\), the knowledge level of the student at row \(i\) and column \(j\).
outputFormat
Output two integers separated by a space: the highest knowledge level among the final winners and the number of students who have that knowledge level.
sample
3 3
1 2 3
3 2 1
2 3 1
3 1