10117_PackingRectangles

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

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

Pro.ID

10117

Title

Packing Rectangles

Title链接

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

AC

4

Submit

14

Ratio

28.57%

时间&空间限制

  • Time Limit: 600/300 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others)
  • 描述


    The six basic layouts of four rectangles

    Four rectangles are given. Find the smallest enclosing (new) rectangle into which these four may be fitted without overlapping. By smallest rectangle, we mean the one with the smallest area.

    All four rectangles should have their sides parallel to the corresponding sides of the enclosing rectangle. Figure 1 shows six ways to fit four rectangles together. These six are the only possible basic layouts, since any other layout can be obtained from a basic layout by rotation or reflection. Rectangles may be rotated 90 degrees during packing.

    There may exist several different enclosing rectangles fulfilling the requirements, all with the same area. You must produce all such enclosing rectangles.

    输入

    Multiple test cases, each case has four lines:

    Four lines, each containing two positive space-separated integers that represent the lengths of a rectangle's two sides. Each side of a rectangle is at least 1 and at most 50.

    输出

    Description

    The six basic layouts of four rectangles

    Four rectangles are given. Find the smallest enclosing (new) rectangle into which these four may be fitted without overlapping. By smallest rectangle, we mean the one with the smallest area.

    All four rectangles should have their sides parallel to the corresponding sides of the enclosing rectangle. Figure 1 shows six ways to fit four rectangles together. These six are the only possible basic layouts, since any other layout can be obtained from a basic layout by rotation or reflection. Rectangles may be rotated 90 degrees during packing.

    There may exist several different enclosing rectangles fulfilling the requirements, all with the same area. You must produce all such enclosing rectangles.

    Input

    Multiple test cases, each case has four lines:

    Four lines, each containing two positive space-separated integers that represent the lengths of a rectangle's two sides. Each side of a rectangle is at least 1 and at most 50.

    Output

    For each test case:

    The output contains one line more than the number of solutions. The first line contains a single integer: the minimum area of the enclosing rectangles. Each of the following lines contains one solution described by two numbers p and q with pq. These lines must be sorted in ascending order of p, and must all be different.

    Sample Input

    1 2
    2 3
    3 4
    4 5

    Sample Output

    40
    4 10
    5 8

    Source

    样例输入

    1 2
    2 3
    3 4
    4 5

    样例输出

    40
    4 10
    5 8

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部