codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

845A.md (1801B)


      1 Source: https://codeforces.com/problemset/problem/845/A
      2 
      3 A. Chess Tourney
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Berland annual chess tournament is coming!
     22 
     23 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.
     24 
     25 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.
     26 
     27 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.
     28 
     29 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.
     30 
     31 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?
     32 
     33 Input
     34 
     35 The first line contains one integer *n* (1 ≤ *n* ≤ 100).
     36 
     37 The second line contains 2·*n* integers *a*1, *a*2, ... *a*2*n* (1 ≤ *a**i* ≤ 1000).
     38 
     39 Output
     40 
     41 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".
     42 
     43 Examples
     44 
     45 Input
     46 
     47 ```
     48 2  
     49 1 3 2 4
     50 ```
     51 
     52 Output
     53 
     54 ```
     55 YES
     56 ```
     57 
     58 Input
     59 
     60 ```
     61 1  
     62 3 3
     63 ```
     64 
     65 Output
     66 
     67 ```
     68 NO
     69 ```