P4613 [COCI2017-2018#5] Olivander

• 467通过
• 705提交
• 题目提供者 da32s1da
• 评测方式 云端评测
• 标签 COCI 2018 高性能
• 难度 入门难度
• 时空限制 1000ms / 64MB
• 提示：收藏到任务计划后，可在首页查看。

题目描述

Harry Potter has damaged his magic wand in a fight with Lord Voldemort. He has decided to get a new wand in Olivander's wand shop. On the floor of the shop, he saw ​N wands and ​N wand boxes. The lengths of the wands are, respectively, $X_1$ ,$X_2$ ...​$X_n$ , and the box sizes are $Y_1$ ,​$Y_2$ ...$Y_n$ . A wand of length ​X can be placed in a box of size ​Y if ​X ≤ ​Y . Harry wants to know if he can place all the wands in boxes so that each box contains exactly one wand. Help him solve this difficult problem.

输入输出格式

输入格式：

The first line of input contains the positive integer ​N (1 ≤ ​N ≤ 100), the number from the task. The second line contains ​N positive integers ​$X_i$ (1 ≤ ​$X_i$ ≤ $10^9$​ ), the numbers from the task. The third line contains ​N positive integers ​$X_i$ (1 ≤ $X_i$ ≤ $10^9$​​ ), the numbers from the task.

输出格式：

If Harry can place all the wands in boxes, output “DA” (Croatian for yes), otherwise output “NE” (Croatian for no).

输入输出样例

输入样例#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

说明

In test cases worth 60% of total points, it will hold ​N ≤ 9.

Clarification of the first test case:

Harry can place the wands in boxes. For example, he can place the wand of length 5 in a box of size 6, wand of length 7 in a box of size 13, and wand of length 9 in a box of size 10.

Clarification of the second test case:

Harry can’t place the wands in boxes because the box of size 2 can’t fit any of the wands.

提示
标程仅供做题后或实在无思路时参考。
请自觉、自律地使用该功能并请对自己的学习负责。
如果发现恶意抄袭标程，将按照I类违反进行处理。