Codeforces Round 302 (Div. 2)
B
Sea and Islands
Codeforces
1400
原题
← AC →
翻译中…

A map of some object is a rectangular field consisting of $*n*$ rows and $*n*$ columns. Each cell is initially occupied by the sea but you can cover some some cells of the map with sand so that exactly $*k*$ islands appear on the map. We will call a set of sand cells to be island if it is possible to get from each of them to each of them by moving only through sand cells and by moving from a cell only to a side-adjacent cell. The cells are called to be side-adjacent if they share a vertical or horizontal side. It is easy to see that islands do not share cells (otherwise they together form a bigger island).

翻译中…

Find a way to cover some cells with sand so that exactly $*k*$ islands appear on the $*n* × *n*$ map, or determine that no such way exists.

翻译中…

Input

翻译中…

The single line contains two positive integers $*n*$, $*k*$ ($1 ≤ *n* ≤ 100$, $0 ≤ *k* ≤ *n*^{2}$) — the size of the map and the number of islands you should form.

翻译中…

Output

翻译中…

If the answer doesn't exist, print "NO" (without the quotes) in a single line.

翻译中…

Otherwise, print "YES" in the first line. In the next $*n*$ lines print the description of the map. Each of the lines of the description must consist only of characters 'S' and 'L', where 'S' is a cell that is occupied by the sea and 'L' is the cell covered with sand. The length of each line of the description must equal $*n*$.

翻译中…

If there are multiple answers, you may print any of them.

翻译中…

You should not maximize the sizes of islands.

翻译中…

样例

Input #1
5 2
Output #1
YES
SSSSS
LLLLL
SSSSS
LLLLL
SSSSS
InputCopy OutputCopy
Input #2
5 25
Output #2
NO
InputCopy OutputCopy
题目信息
题号
544B
时间限制
1 s
内存限制
256 MB
标签
构造
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。