#K76392. Counting Distinct Workflows

    ID: 34632 Type: Default 1000ms 256MiB

Counting Distinct Workflows

Counting Distinct Workflows

This problem asks you to determine the number of distinct workflows that can be created based on employee team assignments. A workflow is formed by grouping employees who belong to the same team (i.e. there is no obstacle between any two employees in a workflow). For each test case, you are given two integers \(n\) and \(k\), where \(n\) is the number of employees and \(k\) is the total number of teams, followed by a list of \(n\) integers representing the team IDs assigned to the employees.

Your task is to count how many unique team IDs appear in the given list for each test case. In other words, the answer for each test case is the number of distinct workflows possible.

inputFormat

The input is provided via stdin and has the following format:

T
n1 k1
team1 team2 ... teamn1
n2 k2
team1 team2 ... teamn2
...

Here, T is the number of test cases. For each test case, the first line contains two integers \(n\) and \(k\), and the second line contains \(n\) space-separated integers denoting the team IDs for the employees.

outputFormat

For each test case, output a single integer on a new line — the number of distinct workflows (i.e. the number of unique team IDs in the list).

## sample
3
4 3
1 1 2 2
5 2
1 1 1 1 1
6 3
1 2 2 3 3 3
2

1 3

</p>