1503.L-craft (easy version)

Time Limit: 1s Memory Limit: 256MB

This is the easy version of the problem. The differences between two versions are the constraint of $n$ and $m$.

Vistar loves to play Minecraft.

Minecraft takes place in a three-dimensional grid world, each occupied by a specific type of cube. It focuses on allowing players to explore, interact with, and change the infinite world. And one of Vistar's favorite gameplay styles is creating buildings.

Recently, he was working on a renovation of his castle. There is an $n \times m$ sized wall in the castle, and to make it artistic, he wants to fill this wall with L-shaped concrete cubes. For example, a $2 \times 4$ example is shown below:

RVTV8uGz4fZiDpvC4uc3TmKAjt8TTW9rI8OYFl2M.jpg

However, Vistar soon realizes that some walls cannot be completely tessellated(i.e., tightly paved) with an L-shape. He wishes to know that, given $n$ and $m$, what is the maximum number of L-shapes that the wall can be filled with?

Since Vistar likes $8$ and its multiples, he wants at least one of $n$ and $m$ to be a multiple of $8$.

Input Format(From the terminal/stdin)

The first line contains a single integer $t$ $(1\le t \le10^4)$ --- the number of test cases.

The first and only line of each test case contains two integers $n$ and $m$ $(1 \le n, m \le 2\cdot 10^5,$ at least one of $n$ and $m$ is a multiple of $8)$.

It is guaranteed that the sum of $n \times m$ over all test cases does not exceed $2\cdot 10^5$.

Output Format(To the terminal/stdout)

For each test case:

Output an $n \times m$ rectangle of non-negative integers to represent your solution. For each positive integer value, it should exactly form an L-shape. For example, the following output:

1 2 2 2 1 0 3 3
1 1 1 2 1 1 1 3

is invalid, because the number 1 appears in two L-shapes and the number 3 doesn't form an L-shape.

Sample Input

Copy
1
2 8
 \n
 · \n

Sample Output special judge

Copy
1 2 2 2 3 4 4 4
1 1 1 2 3 3 3 4
 · · · · · · · \n
 · · · · · · · \n
Source: The 2024 Hunan University Programming Contest

Submit

请先 登录

© 2025 FAQs