21767_L-Shapes

2022-5-16 18:20| 发布者: Hocassian| 查看: 34| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505828966399-Problem List-采集的数据-后羿采集器.html

Pro.ID

21767

Title

L-Shapes

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21767

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 12000/6000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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 x1x2 or y1y2.

    输出

    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 x1x2 or y1y2.

    Output

    The output file should contain a single integer, the total number of distinct pairs of line segments forming L-shapes.

    Sample Input

    7
    0 4 0 7
    4 4 1 6
    1 6 -3 0
    4 4 0 4
    0 0 0 4
    0 0 0 2
    0 4 4 4

    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
    0 4 0 7
    4 4 1 6
    1 6 -3 0
    4 4 0 4
    0 0 0 4
    0 0 0 2
    0 4 4 4

    样例输出

    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.


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部