codeforces-scrape

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

112B.md (1782B)


      1 Source: https://codeforces.com/problemset/problem/112/B
      2 
      3 B. Petya and Square
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Little Petya loves playing with squares. Mum bought him a square 2*n* × 2*n* in size. Petya marked a cell inside the square and now he is solving the following task.
     22 
     23 The task is to draw a broken line that would go along the grid lines and that would cut the square into two equal parts. The cutting line should not have any common points with the marked cell and the resulting two parts should be equal up to rotation.
     24 
     25 Petya wants to determine whether it is possible to cut the square in the required manner given the sizes of the square side and the coordinates of the marked cell. Help him.
     26 
     27 Input
     28 
     29 The first line contains three space-separated integers 2*n*, *x* and *y* (2 ≤ 2*n* ≤ 100, 1 ≤ *x*, *y* ≤ 2*n*), representing the length of a square's side and the coordinates of the marked cell. It is guaranteed that 2*n* is even.
     30 
     31 The coordinates of the marked cell are represented by a pair of numbers *x* *y*, where *x* represents the number of the row and *y* represents the number of the column. The rows and columns are numbered by consecutive integers from 1 to 2*n*. The rows are numbered from top to bottom and the columns are numbered from the left to the right.
     32 
     33 Output
     34 
     35 If the square is possible to cut, print "YES", otherwise print "NO" (without the quotes).
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 4 1 1
     43 ```
     44 
     45 Output
     46 
     47 ```
     48 YES
     49 ```
     50 
     51 Input
     52 
     53 ```
     54 2 2 2
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 NO
     61 ```
     62 
     63 Note
     64 
     65 A sample test from the statement and one of the possible ways of cutting the square are shown in the picture:
     66 
     67  ![](https://espresso.codeforces.com/65145da4e9256287f4353506d6bc4e91d72b2f04.png)