시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 15 | 10 | 10 | 66.667% |
There are n rectangles drawn on the plane. Each rectangle has sides parallel to the coordinate axes and integer coordinates of vertices. We define a block as follows:
The rectangles in the first figure form two separate blocks.
The rectangles in the second form a single block
Write a program that:
In the first line of the standard input there is an integer n, 1 ≤ n ≤ 7,000, which is the number of rectangles. In the following n lines there are coordinates of rectangles. Each rectangle is described by four numbers: coordinates x, y of the bottom-left vertex and coordinates x, y of the top-right vertex. All these coordinates are non-negative integers not greater than 10,000.
In the first and only line of the standard output there should be written a single integer — the number of separate blocks formed by the given rectangles.
9 0 3 2 6 4 5 5 7 4 2 6 4 2 0 3 2 5 3 6 4 3 2 5 3 1 4 4 7 0 0 1 4 0 0 4 1
2