欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1717B.Madoka and Underground Competitions
Madoka and Underground Competitions
Madoka decided to participate in an underground sports programming competition. And there was exactly one task in it:
A square table of size , where is a multiple of , is called good if only the characters '.' and 'X' are written in it, as well as in any subtable of size or , there is at least one character 'X'. In other words, among any 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 . Rows are numbered from to from top to bottom, columns are numbered from to from left to right.
Input
The input consists of multiple test cases. The first line contains a single integer () — the number of test cases. Description of the test cases follows.
The first and the only line of each test case contains four integers , , , () — the size of the table, the integer and the coordinates of the cell, which must contain the character 'X'. It is guaranteed that is a multiple of .
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, output lines, each consisting of 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
..X |
|---|
X.. |
.X. |
It can be proved that there cannot be less than characters 'X' in the answer.
Note that the following table is invalid because cell does not contain the character 'X':
X.. |
|---|
.X. |
..X |
In the second test case, the only correct table is:
XX |
|---|
XX |
Each subtable of size must contain a 'X' character, so all characters in the table must be equal to 'X'.
Samples
3
3 3 3 2
2 1 1 2
6 3 4 2
X..
..X
.X.
XX
XX
.X..X.
X..X..
..X..X
.X..X.
X..X..
..X..X
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |