#P13803. [SWERC 2023] Broken trophy
[SWERC 2023] Broken trophy
题目描述
:::align{center}
:::
Coming back home after triumphally winning your long-coveted trophy, you discover that it was shattered to pieces in your trunk. It just remains to repair it.
Your trophy had the shape of a rectangle of size , for some integer , thereby consisting of 3 lines and columns, containing a total of unit squares. It was broken into pieces, the piece being a rectangle of size for some integers and such that . Such pieces may have been rotated, or even flipped, in the havoc that is your trunk.
As the first step towards repairing your trophy, you should reassemble them in the form of a rectangle of size . More precisely, you have drawn, on a sheet of paper, a rectangle on which you will place your pieces, and you need to know, for all integers and , which piece will cover the unit square on the line and column of your rectangle.
输入格式
The input consists of three lines, each one containing space-separated integers. The first line contains the numbers and . The second line contains the numbers . The third line contains the numbers .
Limits
- ;
- ;
- for all ;
- the pieces described in the input can be reassembled in the form of a rectangle of size .
输出格式
The output should contain three lines, each one consisting of space-separated integers. If you plan to cover the unit square on the line and column with the piece, the number on the output line should be the integer .
In case there are several ways to reassemble your pieces in the form of a rectangle of size , every output representing one of these ways is considered correct.
16 17
1 2 1 1 2 1 2 1 1 1 1 1 2 2 1 1
3 3 1 3 2 3 3 1 1 2 2 3 3 3 1 3
1 2 2 2 12 6 4 13 13 16 16 16 9 10 10 7 7
1 2 2 2 12 6 4 13 13 5 5 14 14 14 11 7 7
1 3 15 8 12 6 4 13 13 5 5 14 14 14 11 7 7
提示
Sample Explanation 1
This output represents the following reassembling:
:::align{center}
:::
Another valid reassembling could be:
:::align{center}
:::