eolymp
bolt
Try our new interface for solving problems
Problems

Rectangular division

Rectangular division

Given \textbf{N} rectangles with sides, parallel to the coordinate axes. Required to determine how many parts of these rectangles divide the plane (inside the parts should not be a boundary of the rectangle). \InputFile The first line contains the number of rectangles \textbf{N} (\textbf{1} ≤ \textbf{N} ≤ \textbf{100}). Next \textbf{N} lines, each containing four numbers: \textbf{x_1}, \textbf{y_1}, \textbf{x_2}, \textbf{y_2} - coordinates of two opposite corners of the rectangle. All coordinates are integers and absolute value does not exceed \textbf{10000}. \OutputFile Derive a single number - the number of parts into which the plane.
Time limit 3 seconds
Memory limit 64 MiB
Input example #1
3
10 20 50 30
40 10 50 25
40 25 80 30
Output example #1
6