#C5667. Coding Competition Final Scores
Coding Competition Final Scores
Coding Competition Final Scores
In this problem, you are given the number of participants and the number of problems in a coding competition. For each participant, you will get a list of integers representing the number of attempts and the time taken for each problem.
The scoring rules are as follows:
- If the number of attempts is
1
, the base score is 10. - If the number of attempts is
2
, the base score is 7. - If the number of attempts is
3
, the base score is 5. - For any other number of attempts, the base score is 0.
For each problem, the final points are computed using the formula:
$final\_points = \max(0, points - time)$
The total score for a participant is the sum of the final points for all problems.
inputFormat
The first line of input contains two integers, N and M, where N is the number of participants and M is the number of problems.
This is followed by N lines, each containing 2*M space-separated integers. For each participant, every pair of integers represents the number of attempts and the time taken (in that order) for a problem.
outputFormat
Output a single line containing N space-separated integers, where each integer represents the final score for each participant in the order of input.
## sample3 2
1 4 3 20
2 10 1 5
0 0 2 5
6 5 2