Pro.ID21767 TitleL-Shapes Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21767 AC0 Submit0 Ratio- 时间&空间限制描述Let's say that two line segments of non-zero length form an L-shape if they are at a 90° angle to each other and one endpoint of one segment coincides with one endpoint of the other. There are N line segments on a plane. The segments are numbered from 1 to N. Count the number of distinct pairs of segments that form L-shapes. Two pairs are considered distinct if they contain segments with different numbers. 输入The first line of the input line contains the integer N (1 ≤ N ≤ 5000). Each of the following N lines describes one segment and contains four integers x1, y1, x2, y2 (-10000 ≤ x1, y1, x2, y2 ≤ 10000), where (x1, y1) and (x2, y2) are endpoints of the segment. It may be assumed that for each segment x1 ≠ x2 or y1 ≠ y2. 输出Description Let's say that two line segments of non-zero length form an L-shape if they are at a 90° angle to each other and one endpoint of one segment coincides with one endpoint of the other. There are N line segments on a plane. The segments are numbered from 1 to N. Count the number of distinct pairs of segments that form L-shapes. Two pairs are considered distinct if they contain segments with different numbers. Input The first line of the input line contains the integer N (1 ≤ N ≤ 5000). Each of the following N lines describes one segment and contains four integers x1, y1, x2, y2 (-10000 ≤ x1, y1, x2, y2 ≤ 10000), where (x1, y1) and (x2, y2) are endpoints of the segment. It may be assumed that for each segment x1 ≠ x2 or y1 ≠ y2. Output The output file should contain a single integer, the total number of distinct pairs of line segments forming L-shapes. Sample Input 7 Sample Output 5 Hint In the example the L-shapes are formed by the following pairs of segments: (1, 4), (1, 7), (2, 3), (4, 5), (5, 7). Note that the segments 4 and 7 coincide, but the pairs (1, 4) and (1, 7), for example, are still considered distinct. Source 样例输入7 样例输出5 提示In the example the L-shapes are formed by the following pairs of segments: (1, 4), (1, 7), (2, 3), (4, 5), (5, 7). Note that the segments 4 and 7 coincide, but the pairs (1, 4) and (1, 7), for example, are still considered distinct. |