21925_BarnExpansion

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

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

Pro.ID

21925

Title

Barn Expansion

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    Farmer John has N ( 1 ≤ N ≤ 25,000 ) rectangular barns on his farm, all with sides parallel to the X and Y axes and integer corner coordinates in the range 0..1,000,000. These barns do not overlap although they may share corners and/or sides with other barns.

    Since he has extra cows to milk this year, FJ would like to expand some of his barns. A barn has room to expand if it does not share a corner or a wall with any other barn. That is, FJ can expand a barn if all four of its walls can be pushed outward by at least some amount without bumping into another barn. If two barns meet at a corner, neither barn can expand.

    Please determine how many barns have room to expand.

    输入

    Line 1: A single integer, N

    Lines 2..N+1: Four space-separated integers A, B, C, and D, describing one barn. The lower-left corner of the barn is at (A, B) and the upper right corner is at (C, D).

    输出

    Description

    Farmer John has N ( 1 ≤ N ≤ 25,000 ) rectangular barns on his farm, all with sides parallel to the X and Y axes and integer corner coordinates in the range 0..1,000,000. These barns do not overlap although they may share corners and/or sides with other barns.

    Since he has extra cows to milk this year, FJ would like to expand some of his barns. A barn has room to expand if it does not share a corner or a wall with any other barn. That is, FJ can expand a barn if all four of its walls can be pushed outward by at least some amount without bumping into another barn. If two barns meet at a corner, neither barn can expand.

    Please determine how many barns have room to expand.

    Input

    Line 1: A single integer, N

    Lines 2..N+1: Four space-separated integers A, B, C, and D, describing one barn. The lower-left corner of the barn is at (A, B) and the upper right corner is at (C, D).

    Output

    Line 1: A single integer that is the number of barns that can be expanded.

    Sample Input

    5
    0 2 2 7
    3 5 5 8
    4 2 6 4
    6 1 8 6
    0 0 8 1

    Sample Output

    2

    Hint

    Explanation of the sample:

    There are 5 barns. The first barn has its lower-left corner at (0, 2) and its upper-right corner at (2, 7), and so on.

    Only two barns can be expanded --- the first two listed in the input. All other barns are each in contact with at least one other barn.

    Source

    样例输入

    5
    0 2 2 7
    3 5 5 8
    4 2 6 4
    6 1 8 6
    0 0 8 1

    样例输出

    2

    提示

    Explanation of the sample:

    There are 5 barns. The first barn has its lower-left corner at (0, 2) and its upper-right corner at (2, 7), and so on.

    Only two barns can be expanded --- the first two listed in the input. All other barns are each in contact with at least one other barn.


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部