CF845A.Chess Tourney
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Berland annual chess tournament is coming!
Organizers have gathered 2·n chess players who should be divided into two teams with n people each. The first team is sponsored by BerOil and the second team is sponsored by BerMobile. Obviously, organizers should guarantee the win for the team of BerOil.
Thus, organizers should divide all 2·n players into two teams with n people each in such a way that the first team always wins.
Every chess player has its rating r__i. It is known that chess player with the greater rating always wins the player with the lower rating. If their ratings are equal then any of the players can win.
After teams assignment there will come a drawing to form n pairs of opponents: in each pair there is a player from the first team and a player from the second team. Every chess player should be in exactly one pair. Every pair plays once. The drawing is totally random.
Is it possible to divide all 2·n players into two teams with n people each so that the player from the first team in every pair wins regardless of the results of the drawing?
Berland 年度国际象棋锦标赛即将到来!
主办方已召集了 2⋅n 名国际象棋选手,需将他们平均分为两支队伍,每队 n 人。第一支队伍由 BerOil 公司赞助,第二支队伍由 BerMobile 公司赞助。显然,主办方必须确保 BerOil 队获胜。
因此,主办方需将全部 2⋅n 名选手划分为两支各含 n 人的队伍,使得第一支队伍始终获胜。
每位国际象棋选手有一个等级分 ri。已知:等级分更高的选手总是战胜等级分更低的选手;若等级分相等,则任意一方均可能获胜。
分队完成后,将通过随机抽签形成 n 对对手:每对中包含一名第一支队伍的选手和一名第二支队伍的选手。每位选手恰好出现在一对中,且每对只进行一局比赛。抽签完全随机。
是否存在一种方式,将全部 2⋅n 名选手划分为两支各含 n 人的队伍,使得无论抽签结果如何,每对中第一支队伍的选手均能获胜?
输入格式
The first line contains one integer n (1 ≤ n ≤ 100).
The second line contains 2·n integers _a_1, _a_2, ... a_2_n (1 ≤ a__i ≤ 1000).
第一行包含一个整数 n(1≤n≤100)。
第二行包含 2n 个整数 a1,a2,…,a2n(1≤ai≤1000)。
输出格式
If it's possible to divide all 2·n players into two teams with n people each so that the player from the first team in every pair wins regardless of the results of the drawing, then print "YES". Otherwise print "NO".
如果可以将全部 2⋅n 名选手分为两支各有 n 人的队伍,使得在每一对选手中,第一支队伍的选手无论抽签结果如何均获胜,则输出 "YES";否则输出 "NO"。
输入输出样例
输入#1
2 1 3 2 4
输出#1
YES
输入#2
1 3 3
输出#2
NO
输入解题思路,AI测评打分。不知道怎么写?