saint or a beast is supposed to be living, if his or its wellbeing esteem is positive (more prominent than or equivalent to 1); and he or it is supposed to be dead, if his or its wellbeing esteem is non-positive (not exactly or equivalent to 0). To secure individuals
Correct answer will be upvoted else downvoted. Computer science.
saint or a beast is supposed to be living, if his or its wellbeing esteem is positive (more prominent than or equivalent to 1); and he or it is supposed to be dead, if his or its wellbeing esteem is non-positive (not exactly or equivalent to 0).
To secure individuals in the country, the saint will battle with beasts until either the legend is dead or every one of the beasts are dead.
In each battle, the legend can choose a subjective living beast and battle with it. Assume the I-th beast is chosen, and the wellbeing upsides of the legend and the I-th beast are x and y before the battle, separately. After the battle, the wellbeing upsides of the legend and the I-th beast become x−
Note that the saint can battle a similar beast more than once.
For the wellbeing of individuals in the nation, if it's not too much trouble, let them know whether the extraordinary legend can kill every one of the beasts (regardless of whether the incredible saint himself is dead subsequent to killing the last beast).
Input
Each test contains numerous experiments. The main line contains t (1≤t≤105) — the number of experiments. Depiction of the experiments follows.
The main line of each experiment contains three integers A (1≤A≤106), B (1≤B≤106) and n (1≤n≤105) — the assault force of the extraordinary legend, the underlying wellbeing worth of the incredible saint, and the number of beasts.
The second line of each experiment contains n integers a1,a2,… ,an (1≤ai≤106), where man-made intelligence means the assault force of the I-th beast.
The third line of each experiment contains n integers b1,b2,… ,bn (1≤bi≤106), where bi signifies the underlying wellbeing worth of the I-th beast.
It is ensured that the amount of n over all experiments doesn't surpass 105.
Output
For each experiment print the appropriate response: "YES" (without quotes) if the incredible saint can kill every one of the beasts. In any case, print "NO" (without quotes).
Step by step
Solved in 4 steps with 1 images