#C1256. Alliance Distinct Score Calculation

    ID: 42000 Type: Default 1000ms 256MiB

Alliance Distinct Score Calculation

Alliance Distinct Score Calculation

In this problem, you are given an integer representing the number of alliances. For each alliance, you are given a list of player scores. Your task is to compute the total distinct score for each alliance. For each alliance, let \( S_i \) be the set of unique scores. Then, you should calculate the sum:

[ \text{answer}i = \sum{s \in S_i} s ]

Output the results for all alliances in one line, separated by a single space.

inputFormat

The input is read from standard input (stdin) and follows this format:

  • The first line contains an integer \( A \), representing the number of alliances.
  • Each of the next \( A \) lines contains space-separated integers representing the scores of all players in that alliance.

outputFormat

Print a single line to standard output (stdout) containing \( A \) integers. Each integer is the sum of the distinct scores for the corresponding alliance. The outputs must be separated by a single space.

## sample
3
50 40 50 60
30 30 40 40 50
80 90 90
150 120 170