The great hero guards the country where Homer lives. The hero has attack power A and initial health value B. There are n monsters in front of the hero. The i-th monster has attack power ai and initial health value bi.
The hero or a monster is said to be living, if his or its health value is positive (greater than or equal to 11); and he or it is said to be dead, if his or its health value is non-positive (less than or equal to 00).
In order to protect people in the country, the hero will fight with monsters until either the hero is dead or all the monsters are dead.
Note that the hero can fight the same monster more than once.
For the safety of the people in the country, please tell them whether the great hero can kill all the monsters (even if the great hero himself is dead after killing the last monster).
Each test contains multiple test cases. The first line contains tt (1≤t≤1051≤t≤105) — the number of test cases. Description of the test cases follows.
The first line of each test case contains three integers AA (1≤A≤1061≤A≤106), BB (1≤B≤1061≤B≤106) and nn (1≤n≤1051≤n≤105) — the attack power of the great hero, the initial health value of the great hero, and the number of monsters.
The second line of each test case contains nn integers a1,a2,…,ana1,a2,…,an (1≤ai≤1061≤ai≤106), where aiai denotes the attack power of the ii-th monster.
The third line of each test case contains nn integers b1,b2,…,bnb1,b2,…,bn (1≤bi≤1061≤bi≤106), where bibi denotes the initial health value of the ii-th monster.
It is guaranteed that the sum of nn over all test cases does not exceed 105105.
For each test case print the answer: "YES" (without quotes) if the great hero can kill all the monsters. Otherwise, print "NO" (without quotes).
【Codeforces Round #700 (Div. 2)】B. The Great Hero
原文:https://www.cnblogs.com/rabbit1103/p/14388342.html