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

9927번 - Rectangles 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB96482334.848%

문제

A rectangle whose edges are parallel to the axes can always be defined by the two ends of one of its diagonals. For example, a rectangle can be drawn when the top left $(x_1, y_1)$ and the bottom right $(x_2, y_2)$ coordinates are given.

Given a set of rectangles, we are interested in finding the total area covered by them. For instance, the total area covered by the rectangles below is the area covered within the solid lines. Notice that there is no double counting for overlapping regions.

Write a program that, given a set of rectangles, computes the total area covered by all the rectangles.

입력

The input describes a set of $N$ rectangles where $N$ ranges between 0 to 1000. On the first line is the integer $N$. The remaining lines are the coordinates of the rectangle. In each of these line, the two points $(x_1, y_1)$ and $(x_2, y_2)$ are given as 4 integers $x_1, y_1, x_2, y_2$ separated by one or more blanks. Note that they are NOT necessarily the top-left and bottom-right coordinates. In addition, $x_i$ and $y_i$ take the value between 0 to 32767ドル$.

출력

On the first line of output, your program must write the total area covered by the rectangles. You may assume that the area is at most 32767.

제한

예제 입력 1

4
20 5 0 15
37 26 14 9
20040 2 20050 18
17 22 33 15

예제 출력 1

715

힌트

출처

Olympiad > National Olympiad in Informatics (Singapore) > NOI 1999 4번

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

출처

대학교 대회

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

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