Time limit: 1 second Memory limit: 256 MB Fruit died (Cheshire ate it and disappeared!…
- User
Time limit: 1 second Memory limit: 256 MB Fruit died (Cheshire ate it and disappeared! Therefore no other information is available).
When Parsa saw that Frut had gone away, he took Frut's keys and opened one of the doors of Wonderland, and suddenly he entered the poetry club to have tea.
As soon as Parsa entered the door, a tray of tea was brought to us n x n He gave him n×n and said to pour sugar into the tea cups. Since Parsa, who seeks justice, wants to distribute these sugars in such a way that the following conditions are met:
1- The number of sugars poured into teas in each row and each column of the tray exactly k be k 2- The difference between the highest and the lowest amount of sugar poured in each row and in each column should be the lowest possible amount.
As long as there is tea, why coffee? input The input contains only one line where two natural numbers n n and k k are separated by a distance. 1 ≤ n ≤ 500 1≤n≤500 1 ≤ k ≤ 1 0 9 1≤k≤10 9
output Your output should be a table n n in n Let n represent the number of sugars in the teas and also have the table of the problem conditions.
Example Sample entry 1 29 Plain text Sample output 1 4 5 5 4 Plain text Sample input 2 5 6 Plain text Sample output 2 1 1 1 1 2 1 2 1 1 1 1 1 2 1 1 1 1 1 2 1 2 1 1 1 1 Plain text Sample entry 3 3 6 Plain text Sample output 3 2 2 2 2 2 2 2 2 2
- Assistant