2015 Mock CCC by Alex and Timothy
Michiru has an interesting Volvox colony which she keeps in a square open-air box (to allow them to photosynthesize). The base of the box is a square with a side length of units . One day, she took a picture of it and printed out an ASCII image of the colony. The image is made of the characters .
, O
, (
, )
, /
, and \
. Since Michiru is an inquisitive girl, she would like to know how many lines of symmetry there are in her Volvox colony.
A line of symmetry can be one of 4 types of lines — either a horizontal line, a vertical line, a diagonal line running top-left to bottom-right, or a diagonal line running top-right to bottom-left. The horizontal and vertical lines must be parallel to the sides of the box, while the diagonal lines must be at angles relative to the sides. Furthermore, a line of symmetry should divide the ASCII image into two halves of equal area which are symmetrical to each other with respect to that line.
For individual characters on the ASCII image, Michiru has observed that:
- The characters
.
andO
are symmetrical to themselves in all 4 directions. - The characters
(
and)
are symmetrical to themselves horizontally, symmetrical to each other vertically, and are asymmetrical diagonally. - The characters
/
and\
are symmetrical to themselves diagonally, and symmetrical to each other both vertically and horizontally.
Please help Michiru count the number of lines of symmetry.
Input Specification
Line 1 of input will contain a single integer , the side length of the box.
The next lines will each contain characters, depicting an ASCII image of the Volvox colony.
Output Specification
The output should be one integer, the number of lines of symmetry.
Sample Input 1
5
.....
.....
.(O).
.....
.....
Sample Output 1
2
Explanation for Sample 1
The Volvox is symmetrical horizontally and vertically, but not diagonally.
Sample Input 2
5
/...\
..O..
.OOO.
..O..
\.../
Sample Output 2
4
Sample Input 3
6
..\/..
\(OO)/
(OOOO)
(OOOO)
/(OO)\
../\..
Sample Output 3
2
Comments
"characters ( and ) are symmetrical to themselves horizontally"
isn't it supposed to be 'to each other'
I believe that it is correct, as a horizontal line is this ("-----------------") way. "(" reflected on that line is itself hence it is symmetrical to itself horizontally. The same applies to ")".
Thanks! I love you balls!
*your
Yeah we figured this out yesterday too. Thanks lolzballs!
I think you're right...