#K86747. Longest Unique Frequency Sequence
Longest Unique Frequency Sequence
Longest Unique Frequency Sequence
You are given T signals, and each signal is represented as a sequence of frequencies. For each signal, your task is to determine the number of unique frequencies in that signal.
More formally, let \(S_i = [f_{i,1}, f_{i,2}, \dots, f_{i,n_i}]\) be the \(i\)-th signal. You need to compute \(|\{f_{i,1}, f_{i,2}, \dots, f_{i,n_i}\}|\), which is the cardinality of the set of frequencies in \(S_i\). Output the result for each signal on a separate line.
Note: All formulas are written in \(\LaTeX\) format. The first input value is an integer \(T\) representing the number of signals, and then for each signal, the first number indicates the number of frequencies in that signal, followed by the sequence of frequencies.
inputFormat
The input is read from standard input and has the following format:
T N1 f1 f2 ... fN1 N2 f1 f2 ... fN2 ... NT f1 f2 ... fNT
where:
- T is the number of signals.
- For each signal, the first number N denotes the length of that signal, followed by N space-separated integers representing the frequencies.
outputFormat
For each signal, output a single integer on a new line representing the number of unique frequencies in that signal.
## sample1
5 1 2 3 4 5
5
</p>