#K7321. Calculate Final Scores Excluding a Flawed Problem
Calculate Final Scores Excluding a Flawed Problem
Calculate Final Scores Excluding a Flawed Problem
In this problem, you are given the scores of multiple participants in a programming contest. Each participant attempted several problems. However, one of the problems turned out to be flawed, so its score should be excluded from each participant's total score. Your task is to compute the final score for each participant by summing up their scores from all the problems except the flawed one.
Formally, suppose there are (n) participants and (m) problems. Let (S_{i,j}) represent the score of the (i)-th participant on the (j)-th problem. You are also given an index (k) (1-based) representing the flawed problem. The final score for participant (i) is (\sum_{j=1}^{m} S_{i,j} - S_{i,k}).
inputFormat
The input is read from standard input (stdin) and is formatted as follows:
The first line contains two integers, (n) and (m) — the number of participants and the number of problems respectively.
This is followed by (n) lines, each containing (m) integers. The (i)-th line contains the scores of the (i)-th participant for each problem.
The last line contains a single integer (k), which is the index (1-based) of the flawed problem.
outputFormat
Output a single line to standard output (stdout) containing (n) integers separated by a single space. The (i)-th integer should be the final score of the (i)-th participant after excluding the flawed problem's score.## sample
4 5
10 20 30 40 50
15 25 5 35 45
0 10 20 30 40
5 15 25 35 45
3
120 120 80 100
</p>