~/algor $ cat problems/boolean-tortburchaklar-kesishadimi
Do the rectangles intersect?
Two rectangles with sides parallel to the coordinate axes are given on the plane. The lower-left corner of the first is $(x_{1}; y_{1})$ and its upper-right corner is $(x_{2}; y_{2})$; for the second they are $(x_{3}; y_{3})$ and $(x_{4}; y_{4})$. The border of a rectangle belongs to it too. Check whether the statement is true: “the rectangles have at least one common point”. Touching only at a corner or along a side also counts as a common point.
Input
The first line contains four integers: $x_{1}$, $y_{1}$, $x_{2}$ and $y_{2}$.
The second line contains four integers: $x_{3}$, $y_{3}$, $x_{4}$ and $y_{4}$.
Output
One integer: $1$ if the statement is true, otherwise $0$.
Note
$-10^{9} \le x_{1} \lt x_{2} \le 10^{9}$
$-10^{9} \le y_{1} \lt y_{2} \le 10^{9}$
$-10^{9} \le x_{3} \lt x_{4} \le 10^{9}$
$-10^{9} \le y_{3} \lt y_{4} \le 10^{9}$
Examples
0 0 4 3 2 1 6 5
1
0 0 2 2 3 0 5 2
0