fitting rectangles in the smallest possible area

前端 未结 3 1826
心在旅途
心在旅途 2021-02-14 16:09

IOI 95

\"basic

The six basic layouts of four rectangles

Four r

3条回答
  •  死守一世寂寞
    2021-02-14 16:50

    While google does turn up some solutions, I guess some high level description will enable you to solve this on your own.

    You can start by naming the rectangles in each of the 6 layout cases 1,2,3,4. Then you should be able to calculate the bounding box for each of the layouts for given instances of rectangles 1...4 (hint for the first case: width=sum of widths of 1...4, height=max of heigths of 1...4)

    Then, as you said, you can try all possible combinations of naming four given rectangles with the indices 1...4 plus for each such possibility try out all possible rotations, and determine the minimum over all such possibilities in all layout cases.

提交回复
热议问题