Salsifa Hall

View as PDF

Submit solution

Points: 7
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

During his graduation trip, GeeTransit got distracted by the interior of a cathedral. What he saw, he described it as a Salsifa Hall, where the 4 walls are a reflection of the tiling on the floor. Here is an example to help you visualize the hall:

Inspired by this intricate design, he decided that it would be a good idea to make the pattern of the hall his floor tiling at home, but there was one problem. When flattened out, the corner pieces are missing, so he added them in by reflecting the edge pieces. The example below shows the transition from a centrepiece to a Salsifa Hall to a complete tile pattern.

You are part of Anabions Tiling Company, and you must help GeeTransit tile his floor by creating a program that accepts his request of the centrepiece, an N \times N grid of spaces and Xs. Being the perfectionist that you are, you will only accept to offer GeeTransit completed tile patterns that meet at least one of the requirements of being horizontally, vertically, or (both ways) diagonally symmetrical.

Input Specification

The first line of the input will contain an integer N (1 \le N \le 15), representing the length and the width of the centrepiece.

The next N lines will each contain a string of length N consisting of spaces and Xs, representing a row of the centrepiece.

Output Specification

This problem uses the identical checker which means the user's output must be exactly the same as the judge's output. Make sure to not include any trailing whitespace and end your output with a new line character.

The completed tile pattern if it meets your requirements, with characters separated by a space. Otherwise, output Offer Denied.

Sample Input 1

3
X  
X  
XXX

Sample Output 1

X X X X X X X X X
    X X         X
    X X         X
    X X         X
    X X         X
X X X X X X X X X
X X X X X X X X X
    X X         X
    X X         X

Explanation for Sample 1

There is only one axis of symmetry that meets the requirements of being horizontally, vertically, or (both ways) diagonally symmetrical.

Sample Input 2

3
X  
 X 
 XX

Sample Output 2

Offer Denied

Explanation for Sample 2

Here is the visualization of the completed tile pattern if it was printed. Since there are no axes of symmetry in this completed tile pattern, the offer is denied.


Comments

There are no comments at the moment.