Disjoint rectangles X35459


Statement
 

pdf   zip

html

Using the definitions

class Point: """attributes: x, y""" class Rectangle: """attributes: width, height, corner"""

write a function

rectangle_disjoint(r1, r2)

that returns True if a rectangle r1 and a rectangle r2 are disjoint (they do not share any point).

Input

The input consists of several pairs of rectangles (four non-negative integer numbers for each: the width, the height, and the coordinates of the lower-left corner).

Output

For each pair of rectangles, print whether or not they are disjoint.

Public test cases
  • Input

    2 1 2 1    6 3 0 0
    6 3 0 0    6 3 0 0
    6 3 0 0    2 1 2 1
    6 3 0 0    6 3 2 1
    6 3 0 0    6 3 6 3
    2 1 0 0    6 3 0 0
    6 3 0 0    2 1 6 0
    6 3 0 0    2 1 0 3
    6 3 0 0    2 1 8 0
    6 3 0 0    2 1 0 4
    

    Output

    False
    False
    False
    False
    False
    False
    False
    False
    True
    True
    
  • Information
    Author
    Gabriel Valiente
    Language
    English
    Official solutions
    Python
    User solutions
    Python