codeforces-scrape

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

958E1.md (1696B)


      1 Source: https://codeforces.com/problemset/problem/958/E1
      2 
      3 E1. Guard Duty (easy)
      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 The Rebel fleet is afraid that the Empire might want to strike back again. Princess Heidi needs to know if it is possible to assign *R* Rebel spaceships to guard *B* bases so that every base has exactly one guardian and each spaceship has exactly one assigned base (in other words, the assignment is a perfect matching). Since she knows how reckless her pilots are, she wants to be sure that any two (straight) paths – from a base to its assigned spaceship – do not intersect in the galaxy plane (that is, in 2D), and so there is no risk of collision.
     22 
     23 Input
     24 
     25 The first line contains two space-separated integers *R*, *B*(1 ≤ *R*, *B* ≤ 10). For 1 ≤ *i* ≤ *R*, the *i* + 1-th line contains two space-separated integers *x**i* and *y**i* (|*x**i*|, |*y**i*| ≤ 10000) denoting the coordinates of the *i*-th Rebel spaceship. The following *B* lines have the same format, denoting the position of bases. It is guaranteed that no two points coincide and that no three points are on the same line.
     26 
     27 Output
     28 
     29 If it is possible to connect Rebel spaceships and bases so as satisfy the constraint, output Yes, otherwise output No (without quote).
     30 
     31 Examples
     32 
     33 Input
     34 
     35 ```
     36 3 3  
     37 0 0  
     38 2 0  
     39 3 1  
     40 -2 1  
     41 0 3  
     42 2 2
     43 ```
     44 
     45 Output
     46 
     47 ```
     48 Yes
     49 ```
     50 
     51 Input
     52 
     53 ```
     54 2 1  
     55 1 0  
     56 2 2  
     57 3 1
     58 ```
     59 
     60 Output
     61 
     62 ```
     63 No
     64 ```
     65 
     66 Note
     67 
     68 For the first example, one possible way is to connect the Rebels and bases in order.
     69 
     70 For the second example, there is no perfect matching between Rebels and bases.