22144_Horseracing

2022-5-16 18:21| 发布者: Hocassian| 查看: 23| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506147060700-Problem List-采集的数据-后羿采集器.html

Pro.ID

22144

Title

Horse racing

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22144

AC

11

Submit

39

Ratio

28.21%

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    There is a horse racing between QW and TJ. SB is to be the judge. QW and TJ both have n horses. Each horse has an ability that is different from any other one. They arrange their horses in a fixed order. The first horse of QW's will compete to the first of TJ's, the second to the second, and so on. Horse with higher ability will beat horse with lower ability. During the n rounds of racings, the one who win most of them will win finally. The loser will lost his horses. Of course, draw game is probably to happen in which suitation SB will get all the horses. You should tell SB if he has chance to get the horses.

    输入

    The first line contains an integer n.   1 ≤ n ≤ 100.

    The second line contains n integers representing the ability of QW's horses.

    The third line also contains n integers representing the ability of TJ's horses.

    输出

    Description

    There is a horse racing between QW and TJ. SB is to be the judge. QW and TJ both have n horses. Each horse has an ability that is different from any other one. They arrange their horses in a fixed order. The first horse of QW's will compete to the first of TJ's, the second to the second, and so on. Horse with higher ability will beat horse with lower ability. During the n rounds of racings, the one who win most of them will win finally. The loser will lost his horses. Of course, draw game is probably to happen in which suitation SB will get all the horses. You should tell SB if he has chance to get the horses.

    Input

    The first line contains an integer n.   1 ≤ n ≤ 100.

    The second line contains n integers representing the ability of QW's horses.

    The third line also contains n integers representing the ability of TJ's horses.

    Output

    If draw game is possible to happen, print "YES", else print "NO".

    Sample Input

    4
    1 2 7 8
    3 4 5 6
    2
    1 2
    3 4

    Sample Output

    YES
    NO

    Source

    样例输入

    4
    1 2 7 8
    3 4 5 6
    2
    1 2
    3 4

    样例输出

    YES
    NO

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部