Codeforces Round 818 (Div. 2)
B
Madoka and Underground Competitions
Codeforces
1100
原题
← AC →
翻译中…

Madoka decided to participate in an underground sports programming competition. And there was exactly one task in it:

翻译中…

A square table of size $n \times n$, where $n$ is a multiple of $k$, is called good if only the characters '.' and 'X' are written in it, as well as in any subtable of size $1 \times k$ or $k \times 1$, there is at least one character 'X'. In other words, among any $k$ consecutive vertical or horizontal cells, there must be at least one containing the character 'X'.

翻译中…

Output any good table that has the minimum possible number of characters 'X', and also the symbol 'X' is written in the cell $(r, c)$. Rows are numbered from $1$ to $n$ from top to bottom, columns are numbered from $1$ to $n$ from left to right.

翻译中…

Input

翻译中…

The input consists of multiple test cases. The first line contains a single integer $t$ ($1 \le t \le 100$) — the number of test cases. Description of the test cases follows.

翻译中…

The first and the only line of each test case contains four integers $n$, $k$, $r$, $c$ ($1 \le n \le 500, 1 \le k \le n, 1 \le r, c \le n$) — the size of the table, the integer $k$ and the coordinates of the cell, which must contain the character 'X'. It is guaranteed that $n$ is a multiple of $k$.

翻译中…

It is guaranteed that the sum of $n$ over all test cases does not exceed $500$.

翻译中…

Output

翻译中…

For each test case, output $n$ lines, each consisting of $n$ characters '.' and 'X', — the desired table. If there are several answers, then you can output anyone.

翻译中…

Note

翻译中…

Let's analyze the first test case.

翻译中…

The following tables can be printed as the correct answer:

翻译中…

X....X.X. or ..XX...X.

翻译中…

It can be proved that there cannot be less than $3$ characters

翻译中…

'X'

翻译中…

in the answer.

翻译中…

Note that the following table is invalid because cell $(3, 2)$ does not contain the character 'X':

翻译中…

X...X...X

翻译中…

In the second test case, the only correct table is:

翻译中…

XXXX

翻译中…

Each subtable of size $1 \times 1$ must contain a

翻译中…

'X'

翻译中…

character, so all characters in the table must be equal to

翻译中…

'X'

翻译中…

.

翻译中…

样例

Input #1
3
3 3 3 2
2 1 1 2
6 3 4 2
Output #1
X..
..X
.X.
XX
XX
.X..X.
X..X..
..X..X
.X..X.
X..X..
..X..X
InputCopy OutputCopy
题目信息
题号
1717B
时间限制
1 s
内存限制
256 MB
标签
构造
模拟

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