logo AlgoBeat OnlineJudge
登录 注册

#200204. [USACO1.2] Transformations

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

题目描述

A square pattern of size () black and white square tiles is transformed into another square pattern. Write a program that will recognize the minimum transformation that has been applied to the original pattern given the following list of possible transformations:

  • #1: 90 Degree Rotation: The pattern was rotated clockwise degrees.
  • #2: 180 Degree Rotation: The pattern was rotated clockwise degrees.
  • #3: 270 Degree Rotation: The pattern was rotated clockwise degrees.
  • #4: Reflection: The pattern was reflected horizontally (turned into a mirror image of itself by reflecting around a vertical line in the middle of the image).
  • #5: Combination: The pattern was reflected horizontally and then subjected to one of the rotations (#1-#3).
  • #6: No Change: The original pattern was not changed.
  • #7: Invalid Transformation: The new pattern was not obtained by any of the above methods.

In the case that more than one transform could have been used, choose the one with the minimum number above.

输入格式

  • Line 1: A single integer, .
  • Line 2..: lines of characters (each either @ or -); this is the square before transformation.
  • Line ..: lines of characters (each either @ or -); this is the square after transformation.

输出格式

A single line containing the number from through described above that categorizes the transformation required to change from the "before" representation to the "after" representation.

样例

样例输入 1

3
@-@
---
@@-
@-@
@--
--@

样例输出 1

1

数据范围与提示

USACO Training Section 1.2.