oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

transformations Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

transformations.html

A square pattern of size N x N (1 <= N <= 10) 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 90 degrees.

* #2: 180 Degree Rotation: The pattern was rotated clockwise 180 degrees.

* #3: 270 Degree Rotation: The pattern was rotated clockwise 270 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.

Input

The first line contains an integer N.

The next N lines contains N characters each. Each character will either be `@' or `-'. This is the square before the transformation.

The next N lines contains N characters each. Each character will either be `@' or `-'. This is the square after the transformation.

Output

Output a single integer, denoting which transformation took place.

Sample Input

3
@[email protected]
---
@@-
@[email protected]
@--
[email protected]

Sample Output

1

Tags

String Processing

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
1100101s32MBAverage
2011s32MBAverage

Judge Compile Command

g++-8 ans.cpp -o transformations -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.