Chef is asked to write a program that takes an array of length and two integers as input and modifies it as follows:
- Choose a random subset of elements of (possibly empty)
- Increase all the elements of the chosen subset by
- Increase the remaining elements in by
You are given , , , and the array that is returned by Chef's program. Determine whether Chef's program gave the correct output.
Input Format
- The first line contains an integer , the number of testcases. The description of the testcases follow.
- Each testcase contains lines.
- The first line of each testcase contains a three space separated integers respectively.
- The second line of each testcase contains space separate integers, the elements of the array .
- The third line of each testcase contains space separate integers, the elements of the array .
Output Format
- For each testcase, print in a single line either
yes
orno
, according to whether Chef's program gave a valid output or not. - You may output the answers in any case, for example the words
Yes
,YeS
,YES
,yES
are all considered equivalent toyes
.
Constraints
- for all indices
Subtasks
Subtask #1 (100 points): original constraints
Sample Input 1
3
3 2 5
9 5 1
11 10 3
3 2 5
9 5 1
11 7 3
3 2 5
9 5 1
11 7 7
Sample Output 1
Yes
Yes
No
Explanation
Test Case 1: The array is . If the chosen elements are then the expected output would be , so the answer is yes
.
Test Case 2: The array is . If the chosen elements are then the expected output would be , so the answer is yes
.
Test Case 3: The array is . There is no subset that can be chosen so that the expected output would be , so Chef's implementation must be incorrect and the answer is no
.
Solution:
This question solution is updated within contest time. please click on follow button and subscribe our channel.if you follow and subscribe our channel then get notification of answer as soon as possible.
No comments:
Post a Comment