QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 256 MB 總分: 100 可 Hack ✓

#15350. 药水

统计

宝宝正在调制一种魔药。为了调制这种魔药,需要 $n$ 种等级从 $1$ 到 $n$ 的原料。更具体地说,对于所有 $1 \le i \le n$,宝宝需要至少 $a_i$ 个等级为 $i$ 的原料来制作魔药,而他的储藏室里只有 $b_i$ 个这种原料。

幸运的是,宝宝可以将高级别的原料降级为低级别的原料(此操作可以进行任意次,包括零次)。宝宝是否可能利用储藏室中的原料制作出魔药?

输入格式

每个输入包含多个测试用例。输入的第一行包含一个整数 $T$(大约 100),表示测试用例的数量。对于每个测试用例:

第一行包含一个整数 $n$($1 \le n \le 100$),表示原料的种类数。

第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$($1 \le a_i \le 10^9$),其中 $a_i$ 表示所需的等级为 $i$ 的原料数量。

第三行包含 $n$ 个整数 $b_1, b_2, \dots, b_n$($1 \le b_i \le 10^9$),其中 $b_i$ 表示宝宝储藏室中现有的等级为 $i$ 的原料数量。

输出格式

对于每个测试用例,输出一行。如果宝宝能够调制出魔药,输出 "Yes"(不含引号),否则输出 "No"(不含引号)。

样例

输入样例 1

2
3
3 3 1
1 2 5
3
3 1 2
5 2 1

输出样例 1

Yes
No

说明

对于第一个样例测试用例,宝宝可以将一个等级为 3 的原料降级为一个等级为 2 的原料,并将两个等级为 3 的原料降级为两个等级为 1 的原料。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.