You are given an array
of integers . You want to convert the array into a permutation of integers. To do this, you can apply the following operation on array exactly once .
- Pick an integer , where . For each , , replace by .
Find out whether it is possible to convert into a permutation of integers. If it is possible, print YES
(all uppercase alphabets) and any possible value of for which it is possible. Otherwise, print NO
(all uppercase alphabets).
Note - An array of integers is called a permutation if it contains all integers from to exactly once.
Input Format
- The first line contains an integer denoting the number of test cases. The test cases then follow.
- The first line of each test case contains an integer .
- The second line of each test case contains space-separated integers .
Output Format
For each testcase, output the required answer in a single line. If an answer exists, print YES
and an integer separated by a single space. Otherwise, print NO
.
Note that the strings are case-sensitive and must be in uppercase alphabets.
Constraints
- Sum of over all cases won't exceed
Subtasks
Subtask #1 (100 points): original constraints
Sample Input 1
2
3
2 7 1
2
2 2
Sample Output 1
YES 4
NO
Explanation
- In the first case, choosing yields as which is a permutation of .
- In the second case, we can't make = for any and for any value of .
No comments:
Post a Comment