#C6290. Distinct Ranks Count

    ID: 50034 Type: Default 1000ms 256MiB

Distinct Ranks Count

Distinct Ranks Count

This problem requires you to determine the number of distinct ranks achieved in several test cases. In each test case, you are given the number of games played, the points scored in each game, and the rank achieved in each game. Your task is to compute and output the number of unique ranks for each test case.

The distinct count is computed using the formula: \( \text{distinct count} = |\{ranks\}| \), where \(|\cdot|\) denotes the cardinality of the set.

inputFormat

The input begins with an integer T indicating the number of test cases. For each test case:

  1. An integer N representing the number of games.
  2. A line with N space-separated integers representing the points after each game.
  3. A line with N space-separated integers representing the ranks after each game.

Note: If N is 0, the next two lines will be empty.

outputFormat

For each test case, output a single integer on a new line representing the number of distinct ranks.## sample

1
5
100 200 300 400 500
1 2 2 3 3
3

</p>