QOJ.ac

QOJ

时间限制: 1 s 内存限制: 512 MB 总分: 100

#14737. Harmonious Matrix

统计

A matrix consisting of 0s and 1s is called harmonious if and only if every element has an even number of neighbors that are 1. The neighbors of an element include the element itself and its four adjacent elements (up, down, left, right), if they exist.

Given the number of rows $m$ and columns $n$, calculate and output a harmonious matrix. Note: A matrix where all elements are 0 is not allowed.

Input

The input consists of a single line containing two space-separated integers $m$ and $n$, representing the number of rows and columns of the matrix, respectively.

Output

Output the matrix with $m$ rows, where each row contains $n$ space-separated integers (0 or 1). The test data guarantees that a solution exists.

Constraints

  • $1 \le m, n \le 40$

Examples

Input 1

4 4

Output 1

0 1 0 0
1 1 1 0
0 0 0 1
1 1 0 1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.