#abc218c. C - Shapes
C - Shapes
Score : points
问题描述
在二维网格(由正方形格子组成)上有两个图形 和 。
在一个具有 行和 列的网格内,由其中 为 #
的格子构成。
同样位于该具有 行和 列的网格内,并由其中 为 #
的格子构成。
判断是否可以通过 -度旋转和平移精确匹配 和 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
We have two figures and on a two-dimensional grid with square cells.
lies within a grid with rows and columns, and consists of the cells where is #
.
lies within the same grid with rows and columns, and consists of the cells where is #
.
Determine whether it is possible to exactly match and by -degree rotations and translations.
Constraints
- Each of and consists of
#
and.
. - Each of and contains at least one
#
.
Input
Input is given from Standard Input in the following format:
Output
Print Yes
if it is possible to exactly match and by -degree rotations and translations, and No
otherwise.
Sample Input 1
5
.....
..#..
.###.
.....
.....
.....
.....
....#
...##
....#
Sample Output 1
Yes
We can match to by rotating it -degrees counter-clockwise and translating it.
Sample Input 2
5
#####
##..#
#..##
#####
.....
#####
#..##
##..#
#####
.....
Sample Output 2
No
It is impossible to match them by -degree rotations and translations.
Sample Input 3
4
#...
..#.
..#.
....
#...
#...
..#.
....
Sample Output 3
Yes
Each of and may not be connected.
Sample Input 4
4
#...
.##.
..#.
....
##..
#...
..#.
....
Sample Output 4
No
Note that it is not allowed to rotate or translate just a part of a figure; it is only allowed to rotate or translate a whole figure.
update @ 2024/3/10 09:38:41