问题 A: Floor Tiles

内存限制:512 MB 时间限制:2 S
题面:Markdown 评测方式:Special Judge 上传者:
提交:8 通过:4

题目描述

**if you need to download problem set in pdf version, click here ->** [2024\_Nowcoder\_Multi\_University\_Training\_Contest\_2.pdf](https://uploadfiles.nowcoder.com/files/20240718/439455_1721264846247/2024_Nowcoder_Multi_University_Training_Contest_2.pdf) Chino has two distinct types of floor tiles, A and B, as depicted in the figure below: ![](https://uploadfiles.nowcoder.com/images/20240709/0_1720523689688/FE07EEE1F0268775C646E844B05BFF2D) Chino's residence is designed as an $N \cdot M$ planar grid, and she intends to pave it entirely with these two types of tiles. Chino is particularly fascinated by the patterns on the tiles. When the patterns on adjacent tiles align perfectly, they form a continuous curve. ![](https://uploadfiles.nowcoder.com/images/20240709/0_1720523697889/D9B6F4554EAD74CEBD62EFFB6A671A52) For example, the left image in the figure above illustrates a configuration with 4 continuous curves, while the right image shows one with 5. After having already placed the first tile, Chino is curious whether it's possible to continue the tiling in such a way that there are exactly $K$ continuous curves. If such an arrangement exists, your task is to help her find at least one valid solution.

输入格式

The first line contains a single positive integer $T (1 \leq T \leq 10^5)$, — the number of test cases. Each test case is described as follows: The first line provides three positive integers $N, M, K (1 \leq N, M \leq 800, 1 \leq K \leq 2 \cdot N \cdot M)$ — the dimensions of Chino's house and the desired number of continuous curves. Subsequently, input two positive integers and a character $x, y, t (1 \leq x \leq N, 1 \leq y \leq M, t \in \{'A', 'B'\})$ — the coordinates and type of the initially placed tile. It is guaranteed that the sum of $N \cdot M$ over all test case does not exceed $10^6$.

输出格式

For each test case: If a solution exists, begin by outputting the word "Yes" to confirm its feasibility. Then, output $N \cdot M$ characters A or B, which represents one such solution. Otherwise, output a single line containing the word "No".

输入样例 复制

2
2 4 6
1 1 A
2 4 15
1 1 A

输出样例 复制

Yes
ABAB
ABAA
No

数据范围与提示

![](https://uploadfiles.nowcoder.com/images/20240709/0_1720523676832/9A11768D2C2EEA7C331011B06A7D4EB2) As shown in the figure.