CF803A.Maximal Binary Matrix

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given matrix with nn rows and nn columns filled with zeroes. You should put kk ones in it in such a way that the resulting matrix is symmetrical with respect to the main diagonal (the diagonal that goes from the top left to the bottom right corner) and is lexicographically maximal.

One matrix is lexicographically greater than the other if the first different number in the first different row from the top in the first matrix is greater than the corresponding number in the second one.

If there exists no such matrix then output -1.

输入格式

The first line consists of two numbers nn and kk ( 1<=n<=1001<=n<=100 , 0<=k<=1060<=k<=10^{6} ).

输出格式

If the answer exists then output resulting matrix. Otherwise output -1.

输入输出样例

  • 输入#1

    2 1
    

    输出#1

    1 0 
    0 0 
    
  • 输入#2

    3 2
    

    输出#2

    1 0 0 
    0 1 0 
    0 0 0 
    
  • 输入#3

    2 5
    

    输出#3

    -1
    
首页