砌砖 Add bricks in the wall

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=22&page=show_problem&problem=1981 [PDF](https://uva.onlinejudge.org/external/110/p11040.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11040/47d1a786069d0bcef35600297b8d3f01a35c87df.png)

输入输出格式

输入格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11040/cef6ec404b938f6083c3102765ce7aefc5288f1f.png)

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA11040/a70da882397b99d986fe9bb78ba20cd9d47de57a.png)

输入输出样例

输入样例 #1

2
255
54 67
10 18 13
3 3 5 2
2 1 2 1 1
256
64 64
16 16 16
4 4 4 4
1 1 1 1 1

输出样例 #1

255
121 134
54 67 67
23 31 36 31
10 13 18 18 13
5 5 8 10 8 5
3 2 3 5 5 3 2
2 1 1 2 3 2 1 1
2 0 1 0 2 1 1 0 1
256
128 128
64 64 64
32 32 32 32
16 16 16 16 16
8 8 8 8 8 8
4 4 4 4 4 4 4
2 2 2 2 2 2 2 2
1 1 1 1 1 1 1 1 1