Codeforces Round 246 (Div. 2)
翻译中…
You have an $*n* × *m*$ rectangle table, its cells are not initially painted. Your task is to paint all cells of the table. The resulting picture should be a tiling of the table with squares. More formally:
翻译中…
- each cell must be painted some color (the colors are marked by uppercase Latin letters);
- we will assume that two cells of the table are connected if they are of the same color and share a side; each connected region of the table must form a square.
翻译中…
Given $*n*$ and $*m*$, find lexicographically minimum coloring of the table that meets the described properties.
翻译中…
Input
翻译中…
The first line contains two integers, $*n*$ and $*m*$ $(1 ≤ *n*, *m* ≤ 100)$.
翻译中…
Output
翻译中…
Print lexicographically minimum coloring of the table that meets the described conditions.
翻译中…
One coloring (let's call it X) is considered lexicographically less than the other one (let's call it Y), if:
翻译中…
- consider all the table cells from left to right and from top to bottom (first, the first cell in the first row, then the second cell in the first row and so on);
- let's find in this order the first cell that has distinct colors in two colorings;
- the letter that marks the color of the cell in X, goes alphabetically before the letter that marks the color of the cell in Y.
翻译中…
样例
Input #1
1 3
Output #1
ABA
InputCopy
OutputCopy
Input #2
2 2
Output #2
AA
AA
InputCopy
OutputCopy
Input #3
3 4
Output #3
AAAB
AAAC
AAAB
InputCopy
OutputCopy
题目信息
标签
构造
贪心
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。