#K46817. Calculate Total Team Scores
Calculate Total Team Scores
Calculate Total Team Scores
You are given the number of teams t, the number of problems p, and a series of scores for each team. Each team may submit multiple attempts for each problem, but only the highest score for each problem is counted towards the team's total score. In this problem, you are provided with the best score for each problem for every team.
Your task is to compute the total score for each team by summing the best scores for all problems. The result should be printed in the same order as the teams are input.
The formula for calculating the total score for a team is given by:
\[ \text{Total Score} = \sum_{i=1}^{p} s_i \]where \(s_i\) is the highest score for the \(i\)-th problem.
inputFormat
The first line contains two integers t
and p
-- the number of teams and the number of problems, respectively.
This is followed by t
lines, each containing p
integers. The i
-th line represents the best scores of the i
-th team for each of the p
problems.
outputFormat
Output a single line containing t
integers separated by a space, where the i
-th integer represents the total score of the i
-th team.
3 4
10 20 30 40
40 30 20 10
15 15 15 15
100 100 60
</p>