#K37317. Strictly Increasing Card Order

    ID: 25950 Type: Default 1000ms 256MiB

Strictly Increasing Card Order

Strictly Increasing Card Order

You are given T test cases. For each test case, you are given an integer N and a sequence of N integers representing card numbers. Your task is to determine whether the deck of cards can be rearranged into a strictly increasing sequence from 1 to N. In other words, after sorting the sequence, it must match exactly the sequence \(1, 2, \ldots, N\).

If the sorted sequence is exactly \(1, 2, \ldots, N\), output Yes; otherwise, output No.

Note: Each test case is processed separately.

inputFormat

The input is given via standard input (stdin). The first line contains an integer T, denoting the number of test cases. Each test case consists of two lines:

  • The first line contains an integer N, the number of cards.
  • The second line contains N space-separated integers representing the values on the cards.

outputFormat

For each test case, print a single line to standard output (stdout) containing either Yes if the deck can be rearranged into the sequence (1, 2, \ldots, N) or No otherwise.## sample

3
5
1 2 3 4 5
4
3 1 2 4
6
1 3 2 5 4 6
Yes

Yes Yes

</p>