CF958A1.Death Stars (easy)
普及/提高-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The stardate is 1977 and the science and art of detecting Death Stars is in its infancy. Princess Heidi has received information about the stars in the nearby solar system from the Rebel spies and now, to help her identify the exact location of the Death Star, she needs to know whether this information is correct.
Two rebel spies have provided her with the maps of the solar system. Each map is an N × N grid, where each cell is either occupied by a star or empty. To see whether the information is correct, Heidi needs to know whether the two maps are of the same solar system, or if possibly one of the spies is actually an Empire double agent, feeding her false information.
Unfortunately, spies may have accidentally rotated a map by 90, 180, or 270 degrees, or flipped it along the vertical or the horizontal axis, before delivering it to Heidi. If Heidi can rotate or flip the maps so that two of them become identical, then those maps are of the same solar system. Otherwise, there are traitors in the Rebel ranks! Help Heidi find out.
星际日期为1977年,探测死星的科学与艺术尚处于萌芽阶段。莉亚公主从义军间谍处获得了附近恒星系中恒星分布的情报,现在,为了精确定位死星的位置,她需要确认这些情报是否准确。
两名义军间谍各自向她提供了一份该恒星系的地图。每张地图是一个 N×N 的网格,其中每个格子要么被一颗恒星占据,要么为空。为验证情报的准确性,莉亚需要判断这两张地图是否描述的是同一个恒星系;否则,其中一名间谍很可能是帝国安插的双重间谍,正向她提供虚假信息。
不幸的是,间谍在将地图呈交给莉亚前,可能无意中对地图进行了如下操作之一:顺时针旋转 90∘、180∘ 或 270∘,或沿垂直轴(上下翻转)或水平轴(左右翻转)进行镜像翻转。若莉亚能通过对其中一张(或两张)地图施加若干次上述变换(旋转或翻转),使得两张地图完全一致,则这两张地图描述的是同一个恒星系;否则,义军内部便存在叛徒!请帮助莉亚查明真相。
输入格式
The first line of the input contains one number N (1 ≤ N ≤ 10) – the dimension of each map. Next N lines each contain N characters, depicting the first map: 'X' indicates a star, while 'O' indicates an empty quadrant of space. Next N lines each contain N characters, depicting the second map in the same format.
输入的第一行包含一个数字 N(1≤N≤10),表示每张星图的维度。接下来的 N 行,每行包含 N 个字符,表示第一张星图:其中 'X' 表示一颗恒星,而 'O' 表示一片空旷的太空区域。再接下来的 N 行,每行同样包含 N 个字符,以相同格式表示第二张星图。
输出格式
The only line of output should contain the word Yes if the maps are identical, or No if it is impossible to match them by performing rotations and translations.
输出仅包含一行,如果两幅地图完全相同,则输出单词 Yes;如果通过旋转和平移无法使它们匹配,则输出 No。
输入输出样例
输入#1
4 XOOO XXOO OOOO XXXX XOOO XOOO XOXO XOXX
输出#1
Yes
输入#2
2 XX OO XO OX
输出#2
No
说明/提示
In the first test, you can match the first map to the second map by first flipping the first map along the vertical axis, and then by rotating it 90 degrees clockwise.
在第一个测试中,你可以通过对第一张地图沿竖直轴翻转,然后顺时针旋转 90 度,使其与第二张地图匹配。
输入解题思路,AI测评打分。不知道怎么写?