当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3647:Tetris

题目描述
Tetris (Russian: Тeтрис) is a puzzle video game originally designed and programmed by Alexey Pajitnov in the Soviet Union. The Tetris game is a popular use of tetrominoes, the four element special case of polyominoes.The seven kinds of tetrominoes are listed below.



We use ‘I’, ‘J’, ‘L’, ‘O’ to stand for the tetrominoes in the top row, and ‘S’, ‘T’, ‘Z’ for the ones in the bottom row.
I enjoy it a lot. But unfortunately, I am not so good at it. So I want a computer program to help me in this game. Given the shapes and falling order of some tetrominoes, and the width and height of a rectangle, the program should check out whether those tetrominoes can fully fill in that rectangle.
There are rules. First of all, you can rotate or move a tetromino, but you can’t flip it. Secondly, let’s assume the height of the screen is unlimited, so there is always enough space to rotate or move a tetromino. Thirdly, to simplify the problem, any tetromino should not be placed under other tetrominos which fell earlier than it. For example:



In the graph above, T is placed under S. If T fell earlier than S, that’s OK. But if T came latter than S, that’s not allowed.
To make it easy, you get only ten tetrominoes in the game. So the area of the rectangle to be filled in is always 40.
输入解释
The input contains no more than 1000 test cases.Each test case contains two lines which are formatted as follows.
n m
t1 t2 ...... t10
n, m are integers indicating the width and height of the rectangle. It is promised that n*m=40. The next line contains 10 characters, each indicating a tetromino. t1 is the first falling tetromino and t10 is the last.
The input is ended by n=0 and m=0
输出解释
For each test case, if those tetrominoes can fill the rectangle, print Yes in a single line, else print No.
输入样例
10 4
I I L Z O J O T T J
4 10
O Z J S T O I J I S
0 0
输出样例
Yes
No

提示
ere is a picture illustrated the first case. It may be helpful for you to understand the problem.
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3647

最后修改于 2020-10-25T23:05:35+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 32768/32768K(Java/Others)