#K476. Taco Score Challenge

    ID: 28234 Type: Default 1000ms 256MiB

Taco Score Challenge

Taco Score Challenge

In the Taco Score Challenge, you are given a series of test cases. In each test case, two participants, Alice and Bob, solve problems of varying difficulties. The difficulty of each problem is an integer value that determines the score awarded for that problem. Specifically, the scoring rules are defined as follows:

$$ \text{score}(d)= \begin{cases}10, & \text{if } d = 1 \\ 20, & \text{if } d = 2 \\ 30, & \text{if } d = 3 \end{cases} $$

Your task is to compute the total score for both Alice and Bob for each test case based on the problems they solved.

Note: It is guaranteed that the problem difficulties will only be from the set \(\{1, 2, 3\}\).

inputFormat

The first line of input contains a single integer \(T\) denoting the number of test cases. The description of the test cases follows.

For each test case:

  • The first line contains an integer \(N\) representing the number of problems solved by Alice.
  • The next line contains \(N\) space-separated integers representing the difficulty levels of the problems solved by Alice.
  • The following line contains an integer \(M\) representing the number of problems solved by Bob.
  • The next line contains \(M\) space-separated integers representing the difficulty levels of the problems solved by Bob.

outputFormat

For each test case, output a single line containing two integers separated by a space. The first integer is the total score obtained by Alice and the second integer is the total score obtained by Bob.

## sample
5
3
1 2 3
2
2 3
4
1 1 1 1
3
2 2 2
2
3 3
2
1 1
1
1
1
3
0

0
60 50

40 60 60 20 10 30 0 0

</p>