| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 69 | 52 | 50 | 76.923% |
Rhonda is printing processor chips, which can be made from fabricated components inscribed onto thin layers. As she prints the chips, Rhonda stacks two or more layers together to create a final chip made up of multiple layers.
She has several unique layers that can be combined into various numbers of layers, which allows her to create a variety of chips. Each layered component is represented by a 10x10 grid of integers, with each cell containing an integer ranging from 0 to 9. The final chip is also 10x10 grid, with each cell being the sum of all the cells in that position for the layers that were used to create the chip.
For example, if Rhonda has fabricated 3 layers:
0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111 1111111111
0011001100 1100110011 0011001100 1100110011 0011001100 1100110011 0011001100 1100110011 0011001100 1100110011
and decides to create a final chip that combines only the first and second layers, the resulting chip is represented by the 10x10 grid below:
01 02 03 04 05 06 07 08 09 10 01 02 03 04 05 06 07 08 09 10 01 02 03 04 05 06 07 08 09 10 01 02 03 04 05 06 07 08 09 10 01 02 03 04 05 06 07 08 09 10 01 02 03 04 05 06 07 08 09 10 01 02 03 04 05 06 07 08 09 10 01 02 03 04 05 06 07 08 09 10 01 02 03 04 05 06 07 08 09 10 01 02 03 04 05 06 07 08 09 10
Each layer is indexed by the order given (starting at zero). The data set for this chip would be:
0 1
since this chip is made by combining the first and second layer in the order given.
The cell values of each individual layer will be in the range 0-9, and the cell values of the final chip combined chips will in the range 0-99. All original fabricated layers will be unique.
The first line of the input will an integer, i, representing the number of unique layers Rhonda has fabricated. This is followed by i sets of 10x10 grid of integers, each followed by a new line, representing the i fabricated layers. The next line will be a single positive integer, n, indication the number of data sets that follow. Each data set is a list of integers, all on one line, separated by spaces, which represent the layers added to create a chip.
A 10x10 integer grid with each of the 10x10 cells represented by 2 digits and a space, the whole grid representing the final summed chip.
3 0101010101 0101010101 0101010101 0101010101 0101010101 0101010101 0101010101 0101010101 0101010101 0101010101 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 7386459728 3748244739 8420475820 1938475283 3847520734 5826752039 4230489329 4594890835 2188305727 4320834420 3 0 1 0 1 2 0 0 0 0 0 0 0 0 0 0
00 02 02 04 04 06 06 08 08 10 00 02 02 04 04 06 06 08 08 10 00 02 02 04 04 06 06 08 08 10 00 02 02 04 04 06 06 08 08 10 00 02 02 04 04 06 06 08 08 10 00 02 02 04 04 06 06 08 08 10 00 02 02 04 04 06 06 08 08 10 00 02 02 04 04 06 06 08 08 10 00 02 02 04 04 06 06 08 08 10 00 02 02 04 04 06 06 08 08 10 07 05 10 10 08 11 15 15 10 18 03 09 06 12 06 10 10 15 11 19 08 06 04 04 08 13 11 16 10 10 01 11 05 12 08 13 11 10 16 13 03 10 06 11 09 08 06 15 11 14 05 10 04 10 11 11 08 08 11 19 04 04 05 04 08 14 15 11 10 19 04 07 11 08 12 15 06 16 11 15 02 03 10 12 07 06 11 15 10 17 04 05 04 04 12 09 10 12 10 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10 00 10