#B3973. Battle Outcome Prediction
Battle Outcome Prediction
Battle Outcome Prediction
Two teams, led by Little S and Little Q, are about to engage in a fierce battle. Each team consists of \(n\) members and the competition is held in \(n\) rounds. In round \(i\), the \(i\)th member from each team will face off.
Let \(a_i\) represent the battle strength of the \(i\)th member of Little S's team, and \(b_i\) represent the battle strength of the \(i\)th member of Little Q's team. In round \(i\):
- If \(a_i > b_i\), Little S's team wins the round.
- If \(a_i < b_i\), Little Q's team wins the round.
- If \(a_i = b_i\), the round is a draw and neither team wins.
After all rounds:
- If the number of rounds won by Little S is greater than that won by Little Q, Little S wins the battle.
- If the number of rounds won by Little S is less than that won by Little Q, Little Q wins the battle.
- If both teams win an equal number of rounds, the battle ends in a draw.
Your task is to determine and output, in order, the number of rounds won by Little S, the number of rounds won by Little Q, and the final result: output "S" if Little S wins, "Q" if Little Q wins, or "D" if it is a draw.
inputFormat
The input consists of three lines:
- An integer \(n\) representing the number of rounds (and the number of team members in each team).
- \(n\) space-separated integers \(a_1, a_2, \ldots, a_n\) representing the battle strengths of Little S's team.
- \(n\) space-separated integers \(b_1, b_2, \ldots, b_n\) representing the battle strengths of Little Q's team.
outputFormat
Output three values separated by spaces: the number of rounds Little S wins, the number of rounds Little Q wins, and the final outcome. The final outcome should be "S" if Little S wins, "Q" if Little Q wins, or "D" if it is a draw.
sample
3
5 3 8
2 3 7
2 0 S