Shawn and Arrays
Shawn has been obsessed about arrays since he read how fun they can be. He recently had a visitor who was ready to challenge Shawn in any array challenge.
Shawn thought about challenging him to a question that he has been working on. He gave the visitor two arrays that contain n positive integers and asked him to check if the arrays are equal.
The arrays will be equal if both the arrays contain the same elements. The permutation of elements doesn’t matter.
If they are not equal, the visitor needs to find the smallest single positive integer element that can be added
to any one of the elements of any of the arrays to make them equal.
Help the visitor in solving the challenge.
Sample Input Format
The first line of input consists of an integer T which is the number of test cases
The first line of each test case contains an integer n which indicates the size of both arrays
The second and third line of each test case contains n space separated integers which are the elements of the first and second arrays respectively
Sample Output Format
For each test case, if
The arrays are equal, print “Yes” (Without quotes)
If the arrays are not equal, print out two space separated integers p and q. Here p is the smallest positive integer that needs to be added to an element of array q
If there is no such integer, then print “No” (Without quotes)
Suppose this is the input:
1 4 0 2 5
2 0 5 1 4
1 1 7 2
1 13 2 1
3 1 7
2 5 4
The expected output is:
For the first test case, we see that both arrays contain the same elements. Hence the expected output is Yes.
For the second test case, we see that if we add the number 6 to the element “7” of the first array, the two arrays become equal.
So the output is 6 1.
For the third test case, the arrays differ by more than one element; hence there is no way we can make both arrays equal by adding a
single positive integer to any element of the array. So, the answer is No.
kindly Help Guys to solve