21643_CuttingRectangles

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

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

Pro.ID

21643

Title

Cutting Rectangles

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    There are several solid rectangles with their edges paralleled to the coordinate axes on the plane, little Bug draws several segments parallel to the x-axis, and he wants to know the sum of the number of solid rectangles that are cut by these segments. We say that a solid rectangle is cut by a segment if and only if they share at least one point. If a solid rectangle is cut by K segments, it will be calculated K times.

    输入

    The first line of input will be a positive integer T ≤ 20, T test cases follow.

    The first line of each test case will be a positive integer N ≤ 30000, the number of solid rectangles. Then N lines follow, each line contains four non-negative integers: x1, y1, x2, y2, representing the lower left and upper right coordinates of the solid rectangle. It's guaranteed that x1 < x2 and y1 < y2. After that there will be a positive integer Q ≤ 30000, which is the number of segments. Then Q lines follow, each line contains four non-negative integers: x3, y3, x4, y4, representing the coordinates of the two end points of the segment, It's guaranteed that x3 < x4 and y3 = y4,

    All integers given are not greater than 100,000,000.

    输出

    Description

    There are several solid rectangles with their edges paralleled to the coordinate axes on the plane, little Bug draws several segments parallel to the x-axis, and he wants to know the sum of the number of solid rectangles that are cut by these segments. We say that a solid rectangle is cut by a segment if and only if they share at least one point. If a solid rectangle is cut by K segments, it will be calculated K times.

    Input

    The first line of input will be a positive integer T ≤ 20, T test cases follow.

    The first line of each test case will be a positive integer N ≤ 30000, the number of solid rectangles. Then N lines follow, each line contains four non-negative integers: x1, y1, x2, y2, representing the lower left and upper right coordinates of the solid rectangle. It's guaranteed that x1 < x2 and y1 < y2. After that there will be a positive integer Q ≤ 30000, which is the number of segments. Then Q lines follow, each line contains four non-negative integers: x3, y3, x4, y4, representing the coordinates of the two end points of the segment, It's guaranteed that x3 < x4 and y3 = y4,

    All integers given are not greater than 100,000,000.

    Output

    For each test case, output one integer on one line, the sum of the number of solid rectangles that are cut by these segments.

    Sample Input

    1
    3
    1 1 3 4
    2 3 4 5
    5 1 6 3
    5
    0 1 6 1
    0 3 6 3
    0 5 6 5
    0 5 2 5
    0 6 2 6

    Sample Output

    3

    Source

    样例输入

    1
    3
    1 1 3 4
    2 3 4 5
    5 1 6 3
    5
    0 1 6 1
    0 3 6 3
    0 5 6 5
    0 5 2 5
    0 6 2 6

    样例输出

    3

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部