#K74777. Maximum Fruit Variety

    ID: 34273 Type: Default 1000ms 256MiB

Maximum Fruit Variety

Maximum Fruit Variety

In this problem, you are given T test cases. For each test case, you are provided with an integer (N) and a sequence of (N) integers representing the fruit types from a row of trees. Your task is to determine the maximum variety of fruits that can be collected, which is defined as the number of distinct fruit types in the sequence.

Mathematically, if the set of fruit types in a test case is (S), then the answer for that test case is (|S|).

Once computed, output the result for each test case on a new line.

inputFormat

The input is read from standard input (stdin) and is structured as follows:

  • The first line contains a single integer (T) denoting the number of test cases.
  • For each test case:
    • The first line contains an integer (N), the number of trees.
    • The second line contains (N) space-separated integers, where each integer represents the type of fruit on a tree.

outputFormat

For each test case, output a single integer representing the number of distinct fruit types (i.e., the maximum variety of fruits that can be collected). Each result should be printed on a new line to standard output (stdout).## sample

2
7
1 2 1 3 4 2 3
5
1 2 3 4 5
4

5

</p>