22563_IConduit!

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

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

Pro.ID

22563

Title

I Conduit!

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Irv Kenneth Diggit works for a company that excavates trenches, digs holes and generally tears up people's yards. Irv's job is to make sure that no underground pipe or cable is underneath where excavation is planned. He has several different maps, one for each utility company, showing where their conduits lie, and he needs to draw one large, consolidated map combining them all. One approach would be to simply draw each of the smaller maps one at a time onto the large map. However, this often wastes time, not to mention ink for the pen-plotter in the office, since in many cases portions of the conduits overlap with each other (albeit at different depths underground). What Irv wants is a way to determine the minimum number of line segments to draw given all the line segments from the separate maps.

    输入

    Input will consist of multiple input sets. Each set will start with a single line containing a positive integer n indicating the total number of line segments from all the smaller maps. Each of the next n lines will contain a description of one segment in the format

    x1  y1  x2  y2

    where (x1, y1) are the coordinates of one endpoint and (x2, y2) are the coordinates of the other. Coordinate values are floating point values in the range 0...1000 specified to at most two decimal places. The maximum number of line segments will be 10000 and all segments will have non-zero length. Following the last input set there will be a line containing a 0 indicating end of input; it should not be processed.

    输出

    Description

    Irv Kenneth Diggit works for a company that excavates trenches, digs holes and generally tears up people's yards. Irv's job is to make sure that no underground pipe or cable is underneath where excavation is planned. He has several different maps, one for each utility company, showing where their conduits lie, and he needs to draw one large, consolidated map combining them all. One approach would be to simply draw each of the smaller maps one at a time onto the large map. However, this often wastes time, not to mention ink for the pen-plotter in the office, since in many cases portions of the conduits overlap with each other (albeit at different depths underground). What Irv wants is a way to determine the minimum number of line segments to draw given all the line segments from the separate maps.

    Input

    Input will consist of multiple input sets. Each set will start with a single line containing a positive integer n indicating the total number of line segments from all the smaller maps. Each of the next n lines will contain a description of one segment in the format

    x1  y1  x2  y2

    where (x1, y1) are the coordinates of one endpoint and (x2, y2) are the coordinates of the other. Coordinate values are floating point values in the range 0...1000 specified to at most two decimal places. The maximum number of line segments will be 10000 and all segments will have non-zero length. Following the last input set there will be a line containing a 0 indicating end of input; it should not be processed.

    Output

    For each input set, output on a single line the minimum number of line segments that need to be drawn on the larger, consolidated map.

    Sample Input

    3
    1.0 10.0 3.0 14.0
    0.0 0.0 20.0 20.0
    10.0 28.0 2.0 12.0
    2
    0.0 0.0 1.0 1.0
    1.0 1.0 2.15 2.15
    2
    0.0 0.0 1.0 1.0
    1.0 1.0 2.15 2.16
    0

    Sample Output

    2
    1
    2

    Source

    样例输入

    3
    1.0 10.0 3.0 14.0
    0.0 0.0 20.0 20.0
    10.0 28.0 2.0 12.0
    2
    0.0 0.0 1.0 1.0
    1.0 1.0 2.15 2.15
    2
    0.0 0.0 1.0 1.0
    1.0 1.0 2.15 2.16
    0

    样例输出

    2
    1
    2

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部