codeforces-scrape

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

1216C.md (2876B)


      1 Source: https://codeforces.com/problemset/problem/1216/C
      2 
      3 C. White Sheet
      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 There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel to the sides of the table. If you will take a look from above and assume that the bottom left corner of the table has coordinates $(0, 0)$, and coordinate axes are left and bottom sides of the table, then the bottom left corner of the white sheet has coordinates $(x_1, y_1)$, and the top right — $(x_2, y_2)$.
     22 
     23 After that two black sheets of paper are placed on the table. Sides of both black sheets are also parallel to the sides of the table. Coordinates of the bottom left corner of the first black sheet are $(x_3, y_3)$, and the top right — $(x_4, y_4)$. Coordinates of the bottom left corner of the second black sheet are $(x_5, y_5)$, and the top right — $(x_6, y_6)$.
     24 
     25  ![](https://espresso.codeforces.com/8e3c95a30e54f5d18c7521f4ef2c692756356d68.png) Example of three rectangles. 
     26 
     27 Determine if some part of the white sheet can be seen from the above after the two black sheets are placed. The part of the white sheet can be seen if there is at least one point lying not strictly inside the white sheet and strictly outside of both black sheets.
     28 
     29 Input
     30 
     31 The first line of the input contains four integers $x_1, y_1, x_2, y_2$ $(0 \le x_1 \lt x_2 \le 10^{6}, 0 \le y_1 \lt y_2 \le 10^{6})$ — coordinates of the bottom left and the top right corners of the white sheet.
     32 
     33 The second line of the input contains four integers $x_3, y_3, x_4, y_4$ $(0 \le x_3 \lt x_4 \le 10^{6}, 0 \le y_3 \lt y_4 \le 10^{6})$ — coordinates of the bottom left and the top right corners of the first black sheet.
     34 
     35 The third line of the input contains four integers $x_5, y_5, x_6, y_6$ $(0 \le x_5 \lt x_6 \le 10^{6}, 0 \le y_5 \lt y_6 \le 10^{6})$ — coordinates of the bottom left and the top right corners of the second black sheet.
     36 
     37 The sides of each sheet of paper are parallel (perpendicular) to the coordinate axes.
     38 
     39 Output
     40 
     41 If some part of the white sheet can be seen from the above after the two black sheets are placed, print "YES" (without quotes). Otherwise print "NO".
     42 
     43 Examples
     44 
     45 Input
     46 
     47 ```
     48 2 2 4 4
     49 1 1 3 5
     50 3 1 5 5
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 NO
     57 ```
     58 
     59 Input
     60 
     61 ```
     62 3 3 7 5
     63 0 0 4 6
     64 0 0 7 4
     65 ```
     66 
     67 Output
     68 
     69 ```
     70 YES
     71 ```
     72 
     73 Input
     74 
     75 ```
     76 5 2 10 5
     77 3 1 7 6
     78 8 1 11 7
     79 ```
     80 
     81 Output
     82 
     83 ```
     84 YES
     85 ```
     86 
     87 Input
     88 
     89 ```
     90 0 0 1000000 1000000
     91 0 0 499999 1000000
     92 500000 0 1000000 1000000
     93 ```
     94 
     95 Output
     96 
     97 ```
     98 YES
     99 ```
    100 
    101 Note
    102 
    103 In the first example the white sheet is fully covered by black sheets.
    104 
    105 In the second example the part of the white sheet can be seen after two black sheets are placed. For example, the point $(6.5, 4.5)$ lies not strictly inside the white sheet and lies strictly outside of both black sheets.