#K15096. Summarize Drum Patterns

    ID: 24280 Type: Default 1000ms 256MiB

Summarize Drum Patterns

Summarize Drum Patterns

You are given a set of drum beat sequences. In each test case, you are provided with an integer N which denotes the number of beats, followed by N integers representing the intensity of each beat.

Your task is to count the occurrences of each unique intensity and output the results in descending order of intensity. For example, if the intensity is i and its count is c, then the output should contain a line in the format: \( i: c \).

If there are multiple test cases, separate the outputs for consecutive cases with an empty line.

inputFormat

The input is read from standard input and has the following format:

T
N_1
b_1 b_2 ... b_(N1)
N_2
b_1 b_2 ... b_(N2)
... 
N_T
b_1 b_2 ... b_(NT)

Here, T is the number of test cases. For each test case, the first line contains the integer N denoting the number of beats, and the second line contains N integers representing the beat intensities separated by spaces.

outputFormat

For each test case, output the unique intensities and their counts in descending order of intensity, each on a new line in the format:

\( intensity: count \)

Separate the output for consecutive test cases with a blank line.

## sample
1
5
3 3 2 2 1
3: 2

2: 2 1: 1

</p>