409986: GYM103886 M Cereal Grids II
Description
Allen has bought some coveted alphabet cereal!
He has $$$n^2$$$ ($$$1 \leq{n^2} \leq{10^6}$$$) total pieces of cereal.
Curiously, the cereal pieces are only in the shape of the letters w, and u. Specifically, he has $$$m$$$ ($$$1 \leq{m} \leq{n^2}$$$) pieces marked w and $$$n^2 - m$$$ pieces marked u.
Of course, he wants to play around with them, and decides to place these cereal pieces into an $$$n$$$ by $$$n$$$ grid of cells. Each piece of cereal must go onto exactly one cell such that the entire grid is filled.
Allen notices that the grid contains some unusual phrases. He is most interested in forming his favorite phrase, uwu. He wants to know the optimal configuration of cereal pieces he can have such that the maximum number of uwu's can be seen on the grid (only horizontally or vertically).
Please help him figure this out!
InputFor each test case, there will be one line of input containing two space separated integers $$$n$$$ and $$$m$$$.
OutputPlease output any grid configuration of $$$n^2$$$ cells if exactly $$$m$$$ of them have to be w, and the rest have to be u, such that there are the maximum possible number of uwu's in the grid.
Any grid configuration that satisfies the constraints and has the maximum uwu's will be considered correct.
Note that an uwu is in the grid if there are three consecutive characters (either horizontally or vertical) that spell out uwu.
ExamplesInput3 5Output
uwu www uwuInput
3 2Output
uwu uwu uuuNote
In the first sample, there are 4 total uwu's in the grid: one on row 1, one on row 3, on on column 1, and one on column 3.
It can be proved that there can be a maximum of 4 uwu's in the grid given the constraints.
Problem Credits: Eric Hsu and Larry Xing