309943: CF1763B. Incinerate

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Incinerate

题意翻译

# Incinerate ## 题目描述 为了消灭人类,怪物协会向地球表面派出了 $n$ 只怪兽。第 $i$ 只怪物有一个生命值 $h_i$ 和一个攻击力 $p_i$ . 凭借他最后的一击,真螺旋焚烧炮,Genos 可以对所有活着的怪物造成 $k$ 点伤害。换句话说,Genos 可以通过一次攻击降低所有怪物 $k$ 点生命值(如果 $k>0$)。 然而,在 Genos 发动的每一次攻击之后,怪物们都会反击。在他们的共同努力下,它们通过活着的最弱的怪物的力量降低 Genos 的攻击伤害。换句话说,在每次攻击后,将$k$的值减去当前所有活着的怪物中的最小$p_i$。 最弱的怪物是力量最小的怪物。 如果怪物的生命值严格大于0,则它是活着的。 Genos 会成功杀死所有怪物吗? ## 输入格式 输入的第一行包含一个整数 $t$ ( $1 \le t \le 100$ ) 表示有 $t$ 组数据。每组数据包含以下内容。 每组数据的第一行包含两个整数,$n$ 和 $k$ ( $1 \le n, k \le 10^5$ )表示怪物的数量和 Genos 的初始攻击伤害。接下来两行,每行包含$n$整数,分别是数组 $h$ 和 $p$ ( $1 \le h_i, p_i \le 10^9$ )。 保证所有数据 $n$ 的总和不超过 $2 \cdot 10^5$。 ## 输出格式 对于每组数据,如果 Genos 可以杀死所有怪物,输出“YES”,否则输出“NO”。 ## 样例 #1 ### 样例输入 #1 ``` 3 6 7 18 5 13 9 10 1 2 7 2 1 2 6 3 4 5 5 5 4 4 4 3 2 2 1 3 1 1 1 ``` ### 样例输出 #1 ``` YES NO YES ``` ## 提示 在第一个样例中,在 Genos 第一次攻击后,$h$和$k$将更新为: - $ h: [11,0,6,2,3,0] $ - $ k: 7-1 = 6 $ 第二次攻击后: - $ h: [5,0,0,0,0,0] $ - $ k: 6-2 = 4 $ 第三次攻击后: - $ h: [1,0,0,0,0,0] $ - $ k: 4-2 = 2 $ 第四次攻击后: - $ h: [0,0,0,0,0,0] $ 由于 Genos 可以杀死所有怪物,所以输出YES。

题目描述

To destroy humanity, The Monster Association sent $ n $ monsters to Earth's surface. The $ i $ -th monster has health $ h_i $ and power $ p_i $ . With his last resort attack, True Spiral Incineration Cannon, Genos can deal $ k $ damage to all monsters alive. In other words, Genos can reduce the health of all monsters by $ k $ (if $ k > 0 $ ) with a single attack. However, after every attack Genos makes, the monsters advance. With their combined efforts, they reduce Genos' attack damage by the power of the $ ^\dagger $ weakest monster $ ^\ddagger $ alive. In other words, the minimum $ p_i $ among all currently living monsters is subtracted from the value of $ k $ after each attack. $ ^\dagger $ The Weakest monster is the one with the least power. $ ^\ddagger $ A monster is alive if its health is strictly greater than $ 0 $ . Will Genos be successful in killing all the monsters?

输入输出格式

输入格式


The first line of the input contains a single integer $ t $ ( $ 1 \le t \le 100 $ ) — the number of test cases. The description of test cases follows. The first line of each test case contains two integers, $ n $ and $ k $ ( $ 1 \le n, k \le 10^5 $ ) — the number of monsters and Genos' initial attack damage. Then two lines follow, each containing $ n $ integers describing the arrays $ h $ and $ p $ ( $ 1 \le h_i, p_i \le 10^9 $ ). It's guaranteed that the sum of $ n $ over all test cases does not exceed $ 2 \cdot 10^5 $ .

输出格式


For each test case, print the answer — "YES" (without quotes) if Genos could kill all monsters and "NO" otherwise.

输入输出样例

输入样例 #1

3
6 7
18 5 13 9 10 1
2 7 2 1 2 6
3 4
5 5 5
4 4 4
3 2
2 1 3
1 1 1

输出样例 #1

YES
NO
YES

说明

In the first example, after Genos' first attack, $ h $ and $ k $ will update to: - $ h: [11,0,6,2,3,0] $ - $ k: 7-1 = 6 $ After second attack: - $ h: [5,0,0,0,0,0] $ - $ k: 6-2 = 4 $ After third attack: - $ h: [1,0,0,0,0,0] $ - $ k: 4-2 = 2 $ After fourth attack: - $ h: [0,0,0,0,0,0] $ As Genos could kill all monsters, the answer is YES.

Input

题意翻译

# Incinerate ## 题目描述 为了消灭人类,怪物协会向地球表面派出了 $n$ 只怪兽。第 $i$ 只怪物有一个生命值 $h_i$ 和一个攻击力 $p_i$ . 凭借他最后的一击,真螺旋焚烧炮,Genos 可以对所有活着的怪物造成 $k$ 点伤害。换句话说,Genos 可以通过一次攻击降低所有怪物 $k$ 点生命值(如果 $k>0$)。 然而,在 Genos 发动的每一次攻击之后,怪物们都会反击。在他们的共同努力下,它们通过活着的最弱的怪物的力量降低 Genos 的攻击伤害。换句话说,在每次攻击后,将$k$的值减去当前所有活着的怪物中的最小$p_i$。 最弱的怪物是力量最小的怪物。 如果怪物的生命值严格大于0,则它是活着的。 Genos 会成功杀死所有怪物吗? ## 输入格式 输入的第一行包含一个整数 $t$ ( $1 \le t \le 100$ ) 表示有 $t$ 组数据。每组数据包含以下内容。 每组数据的第一行包含两个整数,$n$ 和 $k$ ( $1 \le n, k \le 10^5$ )表示怪物的数量和 Genos 的初始攻击伤害。接下来两行,每行包含$n$整数,分别是数组 $h$ 和 $p$ ( $1 \le h_i, p_i \le 10^9$ )。 保证所有数据 $n$ 的总和不超过 $2 \cdot 10^5$。 ## 输出格式 对于每组数据,如果 Genos 可以杀死所有怪物,输出“YES”,否则输出“NO”。 ## 样例 #1 ### 样例输入 #1 ``` 3 6 7 18 5 13 9 10 1 2 7 2 1 2 6 3 4 5 5 5 4 4 4 3 2 2 1 3 1 1 1 ``` ### 样例输出 #1 ``` YES NO YES ``` ## 提示 在第一个样例中,在 Genos 第一次攻击后,$h$和$k$将更新为: - $ h: [11,0,6,2,3,0] $ - $ k: 7-1 = 6 $ 第二次攻击后: - $ h: [5,0,0,0,0,0] $ - $ k: 6-2 = 4 $ 第三次攻击后: - $ h: [1,0,0,0,0,0] $ - $ k: 4-2 = 2 $ 第四次攻击后: - $ h: [0,0,0,0,0,0] $ 由于 Genos 可以杀死所有怪物,所以输出YES。

加入题单

算法标签: