2021牛客多校5 H Holding Two

链接:https://ac.nowcoder.com/acm/contest/11256/H
来源:牛客网

时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 262144K,其他语言524288K
Special Judge, 64bit IO Format: %lld

题目描述

Given n,mn,m_{}n,m, construct a matrix AA_{}A of size n×mn\times mn×m, whose entries are all either 0 or 1, and no three distinct entries Ai1,j1,Ai2,j2,Ai3,j3A_{i_1,j_1}, A_{i_2,j_2}, A_{i_3,j_3}Ai1,j1,Ai2,j2,Ai3,j3 satisfying that Ai1,j1=Ai2,j2=Ai3,j3,−1≤i1−i2=i2−i3≤1,−1≤j1−j2=j2−j3≤1A_{i_1,j_1} = A_{i_2,j_2} = A_{i_3,j_3}, -1\le i_1-i_2=i_2-i_3\le 1, -1\le j_1-j_2=j_2-j_3\le 1Ai1,j1=Ai2,j2=Ai3,j3,−1≤i1−i2=i2−i3≤1,−1≤j1−j2=j2−j3≤1. If multiple solutions exist, print any one of them. If no solution, print “-1” in one line.

输入描述:

Input only one line containing two integers n,m (1≤n,m≤1000)n, m~(1\le n,m \le 1000)n,m (1≤n,m≤1000).

输出描述:

If solutions exist, print nn_{}n lines each containing a 0101_{}01-string of length mm_{}m, denoting the matrix you construct. If no solution, print "-1" in one line.

示例1

输入

[复制](javascript:void(0)

上一篇:653.two-sum-iv-input-is-a-bst


下一篇:[LeetCode] 653. Two Sum IV - Input is a BST