|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||128 MB||0||0||0||0.000%|
A rectangular painting consists of several rectangles that meet the following conditions:
Given the structure of a rectangular painting (see input), we want to find the minimum possible area of the root rectangle by selecting the directions of the alignments of all co-rectangles. Note that the dimensions and orientations of the photo-rectangles are given and cannot be changed.
There are multiple test cases in the input. Each test case starts with a line containing 1 ≤ n ≤ 100 and 0 ≤ d ≤ 30, where n is the number of rectangles in the rectangular painting. In the next n lines, the ith line is the description of the ith rectangle (rectangle with id i). The root-rectangle id is 1. Let Ri be the id set of rectangles whose super-rectangle is the rectangle with id i. If Ri is not empty, the description of the ith rectangle is the size of Ri followed by the members of Ri all separated with spaces. Otherwise, the rectangle is a photo-rectangle and its description is of form “0 a b” where 1 ≤ a ≤ 30 and 1 ≤ b ≤ 30 are the sizes of its x-axis and y-axis sides, respectively. The input terminates with a line containing “0 0”
For each test case, write a single line containing the minimum area of the root rectangle among all possible conformations of the given rectangular painting.
8 1 2 2 3 3 4 5 6 2 7 8 0 10 1 0 10 1 0 10 1 0 1 10 0 1 10 0 0
sample output configuration: