MathDB

2013 QEDMO 13th or 12th

Part of QEDMO

Subcontests

(10)
3
1

n sizes of presents and n packages for Santa Claus

Santa Claus wants to wrap presents. These are available in nn sizes A1<A2<...<AnA_1 <A_2 <...<A_n, and analogously, there are nn packaging sizes B1<B2<...<BnB_1 <B_2 <...<B_n, where BiB_i is enough to all gift sizes AjA_j can be grouped with jij\le i, but too small for those with j>ij> i. On the shelf to the right of Santa Claus are the gifts sorted by size, where the smallest are on the right, of course there can be several gifts of the same size, or none of a size at all. To his left is a shelf with packaging, and also these are sorted from small to large in the same direction. He's brooding in what way he should wrap the gifts and sees two methods for doing this, which depend on his thinking and laziness of movement have been optimized: a) He takes the present closest to him and puts it in the closest packaging, in which it fits in. b) He takes the packaging closest to him and packs in it the closest thing to him gift. In both cases he then does the same again, although of course the one he was using the gift and its packaging are missing, and so on. Once it is not large enough if the packaging or the present is not small enough, he / she will provide the present or the packaging back to its place on the shelf and takes the next-closest. Prove that both methods lead to the same result in the end, they are considered to be exactly the same gifts packed in the same packaging.