logo AlgoBeat OnlineJudge
登录 注册

#213828. [GCPC 2024] Geometric Gridlock

内存限制:1024 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Pentominous is a grid logic puzzle based on the twelve pentominoes. A pentomino is a polygon formed by connecting five equal-sized squares edge to edge.

:::align{center}

Figure G.1: The twelve pentominoes (up to mirroring and rotations) and their names. :::

The goal of this puzzle is to divide a grid into regions of size (that is, pentominoes), so that no two regions that share a side have the same shape. You are allowed to rotate and mirror the pentominoes, but such rotations and reflections count as the same shape. The twelve possible shapes can be seen in Figure G.1.

In a normal Pentominous puzzle, the player is given some pre-filled cells, for which the shape of their region is already predetermined. In this problem, you are working with a completely blank grid of dimensions , and your task is to create any valid arrangement of pentominoes.

输入格式

The input consists of:

  • One line with two integers and (), the height and width of the grid.

输出格式

If there is no valid Pentominous grid, output "". Otherwise, output "", followed by lines of width each, a possible grid using the letters from Figure G.1. If there is more than one solution, any one of them will be accepted.

样例

样例输入 1

3 5

样例输出 1

yes
UUXUU
UXXXU
UUXUU

样例输入 2

2 10

样例输出 2

yes
LLLLNNNPPP
LIIIIINNPP

样例输入 3

99 17

样例输出 3

no

样例输入 4

6 10

样例输出 4

yes
IPPYYYYVVV
IPPXYLLLLV
IPXXXFZZLV
ITWXFFFZUU
ITWWNNFZZU
TTTWWNNNUU

样例输入 5

1 5

样例输出 5

yes
IIIII

数据范围与提示

:::align{center}

Illustration of Sample Output 1. Illustration of Sample Output 2. Illustration of Sample Output 4.

Example Pentominous puzzles for you to try after the contest.

:::