Logo
(追記) (追記ここまで)

8083번 - Rectangles 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB19111066.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:

  • 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.

The rectangles in the first figure form two separate blocks.

The rectangles in the second form a single block

Write a program that:

  • reads the number of rectangles and coordinates of their vertices from the standard input;
  • finds the number of separate blocks formed by the rectangles;
  • writes the result to the standard output.

입력

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.

제한

예제 입력 1

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

예제 출력 1

2

힌트

출처

Olympiad > Polish Olympiad in Informatics > POI 1997/1998 > Stage 3 6번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /