远端评测题 1000ms 63MiB

[COCI 2017/2018 #5] Olivander

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

题目描述

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, X1X_1 ,X2X_2 ...​XnX_n , and the box sizes are Y1Y_1 ,​Y2Y_2 ...YnY_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 ​XiX_i (1 ≤ ​XiX_i10910^9​ ), the numbers from the task. The third line contains ​N positive integers ​XiX_i (1 ≤ XiX_i10910^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).

3
7 9 5
6 13 10
DA
4
5 3 3 5
10 2 10 10
NE
4
5 2 3 2
3 8 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.

0811C班作业

未认领
状态
已结束
题目
12
开始时间
2025-8-11 0:00
截止时间
2025-8-12 23:59
可延期
24 小时