803A.md (1103B)
1 Source: https://codeforces.com/problemset/problem/803/A 2 3 A. Maximal Binary Matrix 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 You are given matrix with *n* rows and *n* columns filled with zeroes. You should put *k* 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. 22 23 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. 24 25 If there exists no such matrix then output -1. 26 27 Input 28 29 The first line consists of two numbers *n* and *k* (1 ≤ *n* ≤ 100, 0 ≤ *k* ≤ 106). 30 31 Output 32 33 If the answer exists then output resulting matrix. Otherwise output -1. 34 35 Examples 36 37 Input 38 39 ``` 40 2 1 41 ``` 42 43 Output 44 45 ``` 46 1 0 47 0 0 48 ``` 49 50 Input 51 52 ``` 53 3 2 54 ``` 55 56 Output 57 58 ``` 59 1 0 0 60 0 1 0 61 0 0 0 62 ``` 63 64 Input 65 66 ``` 67 2 5 68 ``` 69 70 Output 71 72 ``` 73 -1 74 ```