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

9849번 - Rect 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB26719017271.074%

문제

Given a set of rectangles {R1, R2, · · · , Rn}, compute the area of their common intersection. i.e.,

Area (R1 ∩ R2 ∩ · · · ∩ Rn)

The edges of the rectangles R1, R2, · · · , Rn, are either vertical or horizontal lines.

For example, the intersection of 4 rectangles, R1, R2, R3, and R4, in the following figure is the shaded rectangle.

입력

T.IN The first line specifies the number of rectangles n, where 1 < n < 1,000. Since the sides of the rectangles are parallel to the x and y axes, each rectangle is bounded by the lines x = x1, x = x2, y = y1 and y = y2 and each subsequent line of the input thus specifies one rectangle in the following format:

x1 x2 y1 y2

such that 0 ≤ x1 < x2 ≤ 10,000 and 0 ≤ y1 < y2 ≤ 10,000, and x1, x2, y1 and y2 are int

출력

The output contains the area of the intersection of all the rectangles.

제한

예제 입력 1

2
0 2 0 2
1 3 1 3

예제 출력 1

1

예제 입력 2

3
1 4 1 8
0 2 0 5
10 15 22 35

예제 출력 2

0

힌트

출처

Olympiad > National Olympiad in Informatics (Singapore) > NOI 2007 2번

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

출처

대학교 대회

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

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