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

7338번 - Counting Rectangles 다국어

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

문제

We are given a figure consisting of only horizontal and vertical line segments. Our goal is to count the number of all different rectangles formed by these segments. As an example, the number of rectangles in the Figures 1 and 2 are 5 and 0 respectively.

There are many intersection points in the figure. An intersection point is a point shared by at least two segments. The input line segments are such that each intersection point comes from the intersection of exactly one horizontal segment and one vertical segment.

입력

The first line of the file contains a single number M, which is the number of test cases in the file (1 ≤ M ≤ 10), and the rest of the file consists of the data of the test cases. Each test case begins with a line containing s (1 ≤ s ≤= 100), the number of line segments in the figure. It follows by s lines, each containing x and y coordinates of two end points of a segment respectively. The coordinates are integers in the range of 0 to 1000.

출력

The output for each test case is the number of all different rectangles in the figure described by the test case. The output for each test case must be written on a separate line.

제한

예제 입력 1

2
6
0 0 0 20
0 10 25 10
20 10 20 20
0 0 10 0
10 0 10 20
0 20 20 20
3
5 0 5 20
15 5 15 25
0 10 25 10

예제 출력 1

5
0

힌트

출처

ICPC > Regionals > Asia West Continent > Iran > Tehran Site 1999 D번

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

출처

대학교 대회

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

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