{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"伟大的英雄守护着荷马居住的国家。英雄具有攻击力$A$和初始生命值$B$。英雄面前有$n$个怪物。第$i$个怪物具有攻击力$a_i$和初始健康值$b_i$。\n如果英雄或怪物的健康值为正(大于或等于$1$),则称其为活着的英雄或怪物;如果其健康值为非正(小于或等于$0$),则称其已死亡。\n为了保护这个国家的人民,英雄将与怪物战斗,直到英雄死亡或所有怪物死亡。\n在每次战斗中,英雄可以选择一个任意的活怪物并与之战斗。假设选中了第$i$个怪物,英雄和第$i$个怪物战斗前的健康值分别为的$x$和$y$。战斗结束后,英雄和第$i$个怪物的健康值分别变为$x-a_i$和$y-A$。\n请注意,英雄可以与同一个怪物战斗多次。\n为了这个国家人民的安全,请告诉他们这位伟大的英雄是否能够杀死所有的怪物(即使这位伟大的英雄在杀死最后一个怪物后自己已经死了)。"}},{"title":"Input","value":{"format":"MD","content":"第一行包含一个整数$t$($1\\le t\\le 10^5$)——测试用例的数量。\n\n每个测试用例的第一行包含三个整数$A$($1\\leq A\\leq 10^6$)、$B$($1\\leq B\\leq 10^6$)和$n$($1\\leq n\\leq 10^5$)-英雄的攻击力、英雄的初始健康值和怪物数量。\n\n每个测试用例的第二行包含$n$个整数$$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\leq a_i \\leq 10^6$$$),其中$a_i$表示第$i$个怪物的攻击力。\n\n每个测试用例的第三行包含$n$个整数$$$b_1, b_2, \\dots, b_n$$$ ($$$1 \\leq b_i \\leq 10^6$$$),其中$b_i$表示第$i$个怪物的初始健康值\n\n保证所有测试用例的$n$总和不超过$10^5$"}},{"title":"Output","value":{"format":"MD","content":"对于每个测试用例,如果伟大的英雄可以杀死所有怪物,输出YES,否则输出NO"}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\n3 17 1\n2\n16\n10 999 3\n10 20 30\n100 50 30\n1000 1000 4\n200 300 400 500\n1000 1000 1000 1000\n999 999 1\n1000\n1000\n999 999 1\n1000000\n999\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\nYES\nYES\nNO\nYES\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"MD","content":"在第一个例子中:英雄和唯一的怪物之间将有$6$场战斗。之后,怪物死亡,英雄的生命值变为$17 - 6 \\times 2 \u003d 5 \u0026gt; 0$. 所以输出YES,而且英雄还活着。\n\n在第二个例子中:在所有怪物死亡后,英雄的生命值将变为$709$,无论所有战斗的顺序如何都输出YES。\n\n在第三个例子中:一个可能的顺序是与第$1$、$2$、$3$和第$4$个怪物战斗。所有战斗结束后,英雄的生命值变为$-400$。不幸的是,英雄已经死了,但所有的怪物也都死了。所以输出YES。\n\n在第四个例子中:英雄死了,但怪物仍然活着,生命值为$1000 - 999 \u003d 1$。所以输出NO。"}}]}