codeforces-scrape

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

560B.md (1856B)


      1 Source: https://codeforces.com/problemset/problem/560/B
      2 
      3 B. Gerald is into Art
      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 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an *a*1 × *b*1 rectangle, the paintings have shape of a *a*2 × *b*2 and *a*3 × *b*3 rectangles.
     22 
     23 Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?
     24 
     25 Input
     26 
     27 The first line contains two space-separated numbers *a*1 and *b*1 — the sides of the board. Next two lines contain numbers *a*2, *b*2, *a*3 and *b*3 — the sides of the paintings. All numbers *a**i*, *b**i* in the input are integers and fit into the range from 1 to 1000.
     28 
     29 Output
     30 
     31 If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).
     32 
     33 Examples
     34 
     35 Input
     36 
     37 ```
     38 3 2  
     39 1 3  
     40 2 1
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 YES
     47 ```
     48 
     49 Input
     50 
     51 ```
     52 5 5  
     53 3 3  
     54 3 3
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 NO
     61 ```
     62 
     63 Input
     64 
     65 ```
     66 4 2  
     67 2 3  
     68 1 2
     69 ```
     70 
     71 Output
     72 
     73 ```
     74 YES
     75 ```
     76 
     77 Note
     78 
     79 That's how we can place the pictures in the first test:
     80 
     81 ![](https://espresso.codeforces.com/0e4ddd0513ccd77a3ba26e2a301417998d8fce26.png)
     82 
     83 And that's how we can do it in the third one.
     84 
     85 ![](https://espresso.codeforces.com/2977c6ca37a9e5a27fa3b57f693ca03c3a37fbdf.png)