10221_ZingZhu'sOysterFar

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

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

Pro.ID

10221

Title

Zing Zhu's Oyster Farm

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    Zing Zhu owns an island that is a piece of flat land. Everyday, when the tide rises, the island is flooded by sea water. After much thinking and asking advice from members of his family, Zing Zhu decided to set up an oyster farm in the island. Zing Zhu uses a sophisticated system of plastic watertight modular fences to control the areas that will be flooded and the areas that will not be flooded during the rise of the tide. The fences used by Zing Zhu are either horizontal or vertical and come in strips that have different lengths and heights. Two fences can intersect in at most one point, not necessarily in their ends.

    You have been contacted by Zing Zhu to calculate, given the height the tide will reach and the position and height of all fence strips, the total area of land which will not be flooded during the high tide. You may assume that the widths of fence strips are so thin compared to the size of the land that, for the purpose of calculating the total area, fence strips may be considered as having widths equal to zero.

    输入

    The input contains several test cases. The first line of a test case contains an integer N indicating the number of fence strips in the island (1 ≤ N ≤ 2000). Each of the next N lines contains five integers X1, Y1, X2, Y2 and H, representing respectively the start point of the strip (X1, Y1), the end point of the strip (X2, Y2) and the strip height (H). The last line of a test case contains an integer W representing the tide height. Coordinates are given in meters, heights in centimeters. Furthermore, X1 = X2 or Y1 = Y2 (but not both); -500 ≤ X1, Y1, X2, Y2 ≤ 500; and 1 ≤ W, H ≤ 1000. The end of input is indicated by N = 0.

    输出

    Description

    Zing Zhu owns an island that is a piece of flat land. Everyday, when the tide rises, the island is flooded by sea water. After much thinking and asking advice from members of his family, Zing Zhu decided to set up an oyster farm in the island. Zing Zhu uses a sophisticated system of plastic watertight modular fences to control the areas that will be flooded and the areas that will not be flooded during the rise of the tide. The fences used by Zing Zhu are either horizontal or vertical and come in strips that have different lengths and heights. Two fences can intersect in at most one point, not necessarily in their ends.

    You have been contacted by Zing Zhu to calculate, given the height the tide will reach and the position and height of all fence strips, the total area of land which will not be flooded during the high tide. You may assume that the widths of fence strips are so thin compared to the size of the land that, for the purpose of calculating the total area, fence strips may be considered as having widths equal to zero.

    Input

    The input contains several test cases. The first line of a test case contains an integer N indicating the number of fence strips in the island (1 ≤ N ≤ 2000). Each of the next N lines contains five integers X1, Y1, X2, Y2 and H, representing respectively the start point of the strip (X1, Y1), the end point of the strip (X2, Y2) and the strip height (H). The last line of a test case contains an integer W representing the tide height. Coordinates are given in meters, heights in centimeters. Furthermore, X1 = X2 or Y1 = Y2 (but not both); -500 ≤ X1, Y1, X2, Y2 ≤ 500; and 1 ≤ W, H ≤ 1000. The end of input is indicated by N = 0.

    Output

    For each test case in the input your program must produce one line of output, containing one integer representing the total area (in m2) of the land which will not be flooded.

    Sample Input

    4
    -20 20 20 20 200
    20 20 20 -20 200
    0 0 0 20 100
    -10 0 20 0 200
    100
    4
    -20 20 20 20 200
    20 20 20 -20 200
    0 0 0 20 100
    -10 0 20 0 200
    101
    0

    Sample Output

    400
    0

    Source

    样例输入

    4
    -20 20 20 20 200
    20 20 20 -20 200
    0 0 0 20 100
    -10 0 20 0 200
    100
    4
    -20 20 20 20 200
    20 20 20 -20 200
    0 0 0 20 100
    -10 0 20 0 200
    101
    0

    样例输出

    400
    0

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部