I have encountered several array problems in C + +. I hope the big God can solve the puzzle. It's best to have comments

2022-02-02 12:21:08

Arrange and judge

describe
There are multiple sets of tests , Each set of tests will give a length of n Array of P, You need to use the program to judge P Whether the number in is a 1-n Permutation
（ contain 1-n Once each ）.
Input format
The first 1 That's ok ：1 A digital t, Indicates the number of groups tested （1 < t <= 1000）. After that, each group of data has two rows ：
The first 1 That's ok ：1 A digital n, Represents the length of an array （1 < n <= 500）.
The first 2 That's ok ： common n A digital P[i], Space between , The elements of the corresponding array （1 < P[i] <= 10^9）.
Output format
The output, t That's ok , The judgment result corresponding to each group of data , Output “Yes” perhaps "No".
Data range
1 <= t <= 1000,1 < n <= 500,1 < P[i] <= 10^9
sample input
2
4
1 2 4 3
4
1 4 2 2
sample output
Yes
NO
Sample explanation
1 2 4 3 contain 1-4 Once each , So the output "Yes",
1 4 2 2 It doesn't include 3, an 2 individual 2, So the output "No"