21549_Overplanting

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

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

Pro.ID

21549

Title

Overplanting

Title链接

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

AC

9

Submit

60

Ratio

15.00%

时间&空间限制

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

    Farmer John has purchased a new machine that is capable of planting grass within any rectangular region of his farm that is "axially aligned" (i.e., with vertical and horizontal sides).  Unfortunately, the machine malfunctions one day and plants grass in not one, but N (1 ≤ N ≤ 1000) different rectangular regions, some of which may even overlap.

    Given the rectangular regions planted with grass, please help FJ compute the total area in his farm that is now covered with grass.

    输入

    * Line 1: The integer N.

    * Lines 2..1+N: Each line contains four space-separated integers x1  y1  x2  y2 specifying a rectangular region with upper-left corner (x1, y1) and lower-right corner (x2, y2).  All coordinates are in the range -108...108.

    输出

    Description

    Farmer John has purchased a new machine that is capable of planting grass within any rectangular region of his farm that is "axially aligned" (i.e., with vertical and horizontal sides).  Unfortunately, the machine malfunctions one day and plants grass in not one, but N (1 ≤ N ≤ 1000) different rectangular regions, some of which may even overlap.

    Given the rectangular regions planted with grass, please help FJ compute the total area in his farm that is now covered with grass.

    Input

    * Line 1: The integer N.

    * Lines 2..1+N: Each line contains four space-separated integers x1  y1  x2  y2 specifying a rectangular region with upper-left corner (x1, y1) and lower-right corner (x2, y2).  All coordinates are in the range -108...108.

    Output

    * Line 1: The total area covered by grass.  Note that this could be too large to fit into a 32-bit integer.

    Sample Input

    2
    0 5 4 1
    2 4 6 2

    Sample Output

    20

    Source

    样例输入

    2
    0 5 4 1
    2 4 6 2

    样例输出

    20

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部