1.4 Optimised Conference Seating Layout
At TechSphere Corporation, the facilities management team is tasked with designing the layout of the conference room seating for a series of upcoming workshops. The room is large, with seats arranged in a grid format. To ensure optimal engagement and comfort, the team wants to create a pattern where each seat (represented as a cell in the grid) has exactly two neighboring seats that are different in type. The seats are either designated as "Standard" (0) or "Premium" (1).
Constraints
1≤t≤100
2≤n,m≤50
n and m are even integers.
Input Format
The first line contains a single integer t — the number of test cases.
For each test case, the next line contains two even integers n and m — the height and width of the matrix, respectively.
Output Format
For each test case, output n lines of m numbers (either 0 or 1), representing the seating layout that meets the criteria. It is guaranteed that a valid solution always exists.The first seat of the first row must be a standard seat as in example
Example 1
Input:
3
2 4
2 2
4 4
Output:
0 1 1 0
1 0 0 1
0 1
1 0
0 1 1 0
1 0 0 1
1 0 0 1
0 1 1 0
Explanation:
For each matrix it creates a checkerboard pattern where atleast two neighbours of each cell have different values.
Log In to solve the Question