QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 64 MB مجموع النقاط: 50

#13690. 奥利凡德

الإحصائيات

哈利·波特在与伏地魔的战斗中损坏了他的魔杖。他决定去奥利凡德魔杖店买一根新魔杖。在店里的地板上,他看到了 $N$ 根魔杖和 $N$ 个魔杖盒子。魔杖的长度分别为 $X_1, X_2 \dots X_N$,盒子的尺寸分别为 $Y_1, Y_2 \dots Y_N$。如果 $X \le Y$,一根长度为 $X$ 的魔杖可以放入一个尺寸为 $Y$ 的盒子中。哈利想知道他是否可以将所有的魔杖都放入盒子中,使得每个盒子恰好装有一根魔杖。

请帮助他解决这个难题。

输入格式

第一行包含一个正整数 $N$ ($1 \le N \le 100$),表示魔杖和盒子的数量。

第二行包含 $N$ 个正整数 $X_i$ ($1 \le X_i \le 10^9$),表示每根魔杖的长度。

第三行包含 $N$ 个正整数 $Y_i$ ($1 \le Y_i \le 10^9$),表示每个盒子的尺寸。

输出格式

如果哈利可以将所有魔杖放入盒子中,输出 "DA"(克罗地亚语中的“是”),否则输出 "NE"(克罗地亚语中的“否”)。

子任务

对于 $60\%$ 的测试数据,满足 $N \le 9$。

样例

输入样例 1

3
7 9 5
6 13 10

输出样例 1

DA

输入样例 2

4
5 3 3 5
10 2 10 10

输出样例 2

NE

输入样例 3

4
5 2 3 2
3 8 3 3

输出样例 3

DA

说明

样例 1 说明: 哈利可以将魔杖放入盒子中。例如,他可以将长度为 $5$ 的魔杖放入尺寸为 $6$ 的盒子中,长度为 $7$ 的魔杖放入尺寸为 $13$ 的盒子中,长度为 $9$ 的魔杖放入尺寸为 $10$ 的盒子中。

样例 2 说明: 哈利无法将魔杖放入盒子中,因为尺寸为 $2$ 的盒子无法容纳任何一根魔杖。

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.