Rectangles (2) P82952


Statement
 

pdf   zip

html

Using the definitions and procedures of the exercise : “” that you need, your task is to write a program that reads a series of sequences of rectangles, and for each one prints the final result of their intersection.

Input

Input consists of several sequence of rectangles. Each sequence starts with a natural strictly positive n, followed by the description of n rectangles (four integer numbers each one). A special sequence with n = 0 indicates the end of the input.

Output

For each sequence of rectangles, print the final result of their intersection following the format of the instance. If the intersection is empty (that is, if has area zero), print “empty intersection”.

Public test cases
  • Input

    3
    0 10 0 10
    2 4 2 4
    3 5 3 5
    2
    -10 -5 0 5
    -4 -2 2 3
    1
    1 2 3 4
    2
    0 1 0 1
    1 2 0 1
    0
    

    Output

    bottom left point = (3, 3); top right point = (4, 4)
    empty intersection
    bottom left point = (1, 3); top right point = (2, 4)
    empty intersection
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++