#K43217. Card Game Scoring
Card Game Scoring
Card Game Scoring
Two players, Jane and Mark, are playing a card game. In each test case, you are given a set of cards. The rule is simple: first, sort the cards in descending order. Then, Jane picks the first card, Mark picks the second, Jane picks the third, and so on.
The scores are computed as follows:
$$ \text{Jane's score} = \sum_{i=0}^{\lfloor (N-1)/2 \rfloor} c_{2i} $$
$$ \text{Mark's score} = \sum_{i=0}^{\lfloor (N-2)/2 \rfloor} c_{2i+1} $$
Here, \(c_i\) (for \(0 \le i < N\)) are the card values after sorting, and \(N\) is the total number of cards in the test case.
Your task is to calculate and output the scores for Jane and Mark for each test case.
inputFormat
The input begins with an integer \(T\) representing the number of test cases. Each test case consists of:
- An integer \(N\): the number of cards.
- A sequence of \(N\) space-separated integers representing the card values.
Input is given via standard input (stdin).
outputFormat
For each test case, output a single line containing two integers separated by a space: the score of Jane and the score of Mark, respectively. Output is produced via standard output (stdout).
## sample1
4
1 2 10 3
12 4
</p>