[Solution] Almost Ternary Matrix Codeforces Solution
You are given two even integers and . Your task is to find any binary matrix with rows and columns where every cell has exactly two neighbours with a different value than .
Two cells in the matrix are considered neighbours if and only if they share a side. More formally, the neighbours of cell are: , , and .
It can be proven that under the given constraints, an answer always exists.
Each test contains multiple test cases. The first line of input contains a single integer () — the number of test cases. The following lines contain the descriptions of the test cases.
The only line of each test case contains two even integers and () — the height and width of the binary matrix, respectively.
The Third Three Number Problem Codeforces Solution
Almost Ternary Matrix Codeforces Solution
The Third Problem Codeforces Solution
For each test case, print lines, each of which contains numbers, equal to or — any binary matrix which satisfies the constraints described in the statement.
It can be proven that under the given constraints, an answer always exists.
No comments:
Post a Comment