0 人解决,7 人已尝试。
0 份提交通过,共有 14 份提交。
9.9 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
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:
each rectangle is a block,
if two distinct blocks have a common segment then they form the new block otherwise we say that these blocks are separate.
Examples:
Write a program that:
reads the number of rectangles and coordinates of their vertices;
finds the number of separate blocks formed by the rectangles;
writes the result.
In the first line of the input there is an integer n, 1 <= n <=7000, 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 10000.
In the first and only line of the 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
0 人解决,7 人已尝试。
0 份提交通过,共有 14 份提交。
9.9 EMB 奖励。