#K35317. Baseball Game Results
Baseball Game Results
Baseball Game Results
In this problem, you are required to calculate the final scores of a series of baseball games and determine whether any injuries occurred during the games. Each game consists of several innings. In every inning, both teams score some runs and there is an indicator to show if an injury occurred (1 indicates an injury, 0 means no injury). If an injury occurs in any inning of the game, the overall injury status becomes Injured; otherwise, it is Safe.
Formally, for each game test case, you are given an integer (N) representing the number of innings. Then for each inning you will get three integers (a, b, c) where (a) is Team 1's score, (b) is Team 2's score, and (c) is the injury indicator. The final output for that test case should be in the format: [ \text{Team1_final_score Team2_final_score Injury_status} ]
Your task is to process multiple test cases from the input and print the result of each game on a separate line.
inputFormat
The input is given via standard input (stdin). The first line contains an integer (T), the number of test cases. For each test case, the first line contains an integer (N) representing the number of innings. This is followed by (N) lines, each containing three space-separated integers: (a) (Team 1's score for the inning), (b) (Team 2's score for the inning), and (c) (the injury indicator, where 1 means an injury occurred and 0 otherwise).
outputFormat
For each test case, output a single line with three items: the total score of Team 1, the total score of Team 2, and the injury status. The injury status should be "Injured" if any inning in the test case has an injury indicator of 1, otherwise output "Safe". The outputs are printed to standard output (stdout).## sample
2
3
5 7 0
2 3 1
4 2 0
4
6 3 0
4 5 1
2 2 0
1 1 0
11 12 Injured
13 11 Injured
</p>