| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 1 | 0 | 0 | 0.000% |
Irus had a rectangle. Irus cut the rectangle and obtained two rectangles. He then put one aside and cut the other one, and continued cutting the same way (never cutting rectangles that were put aside) until he had K rectangles. The edges of all the rectangles have integer lengths.
After he sorted the rectangles by the lengths of their longer edges, Irus realized that these lengths are all distinct (however the lengths of the shorter edges need not be distinct).
Irus forgot the dimensions of the initial rectangle. Help Irus remember them.
The first line contains the number of rectangles K. The remaining K lines contain two natural numbers each, ai and bi, which are the edge lengths of the i-th rectangle, and these numbers are ordered so that ai ≥ bi, and a1 < · · · < aK.
In the first line, output P – the total number of possible dimensions of the initial rectangle.
In the next P lines, output the lengths of the shorter edges of all possible initial rectangles, from smallest to largest (note that we count a rectangle of certain dimensions at most once, even if there are several ways to cut it into the K given rectangles).
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 25 | K ≤ 10 |
| 2 | 20 | bi = 1 |
| 3 | 55 | No additional contraints |
3 2 1 3 2 4 2
2 2 4
The initial rectangles could have been cut in the following ways:
Olympiad > Lithuanian Olympiad in Informatics > Lithuanian Olympiad in Informatics 2017/2018 > National Round (2) > 10-12 Classes ?번