#P9114. POI Scoring and Ranking
POI Scoring and Ranking
POI Scoring and Ranking
The Plovdiv Olympiad in Informatics (POI) is underway with \(N\) contestants and \(T\) problems. Each problem has a single test case so that for every contestant and every problem, the contestant either solves the problem completely or not at all (no partial scoring).
After the contest, the score for each problem is the number of contestants who did not solve it. A contestant's total score is the sum of the scores for the problems they solved.
Prior to the contest, contestants are numbered from \(1\) to \(N\). Philip is contestant number \(P\). The final ranking is determined by sorting contestants in descending order by total score. To break ties, contestants with equal total scores are ranked by the number of problems solved (more solved problems leads to a higher rank). If there is still a tie, they are sorted by their contestant number in ascending order.
Your task is to write a program that, given the solving status of each contestant for each problem, determines Philip's total score and his ranking.
inputFormat
The input begins with a line containing three integers \(N\), \(T\), and \(P\) (1 \(\leq\) \(P\) \(\leq\) \(N\); 1 \(\leq\) \(T\) \(\leq\) 1000), representing the number of contestants, the number of problems, and Philip's contestant number, respectively.
Then follow \(N\) lines. The \(i\)-th of these lines (1-indexed) contains \(T\) integers (each 0 or 1) separated by spaces. The \(j\)-th integer indicates whether contestant \(i\) solved problem \(j\) (1 means solved, 0 means not solved).
outputFormat
Output two integers separated by a space: Philip's total score and his ranking after the contest.
sample
3 3 2
1 0 1
0 1 1
1 1 0
2 2