Pro.ID22144 TitleHorse racing Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22144 AC11 Submit39 Ratio28.21% 时间&空间限制描述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 Sample Output YES Source 样例输入4 样例输出YES 作者 |