1231. Sylvester construction

单点时限: 2.0 sec

内存限制: 256 MB

输入格式

The first number in the input is the number of test cases to follow. For each test case there are five integers: n, x, y, w and h. n will be between 1 and $2^{62}$ (inclusive) and will be a power of 2. x and y specify the upper left corner of the sub matrix to be printed, w and h specify the width and height respectively. Coordinates are zero based, so 0 ≤ x,y < n. You can assume that the sub matrix will fit entirely inside the whole matrix and that 0 < w,h ≤ 20. There will be no more than 1000 test cases.

输出格式

For each test case print the sub matrix followed by an empty line.

样例

Input
3
2 0 0 2 2
4 1 1 3 3
268435456 12345 67890 11 12
Output
1 1
1 -1
-1 1 -1
1 -1 -1
-1 -1 1
1 -1 -1 1 1 -1 -1 1 1 -1 -1
-1 -1 1 1 -1 -1 1 1 -1 -1 1
1 1 1 -1 -1 -1 -1 1 1 1 1
-1 1 -1 -1 1 -1 1 1 -1 1 -1
1 -1 -1 -1 -1 1 1 1 1 -1 -1
-1 -1 1 -1 1 1 -1 1 -1 -1 1
-1 -1 -1 -1 -1 -1 -1 1 1 1 1
1 -1 1 -1 1 -1 1 1 -1 1 -1
-1 1 1 -1 -1 1 1 1 1 -1 -1
1 1 -1 -1 1 1 -1 1 -1 -1 1
-1 -1 -1 1 1 1 1 1 1 1 1
1 -1 1 1 -1 1 -1 1 -1 1 -1

18 人解决,24 人已尝试。

20 份提交通过,共有 77 份提交。

5.1 EMB 奖励。

创建: 17 年,4 月前.

修改: 7 年,1 月前.

最后提交: 3 年,10 月前.

来源: NCPC 2004

题目标签