Debug
While debugging a program Mirko noticed that a bug in the program may be linked with the existence of so called square killers in the program memory. The program memory is a matrix composed of R rows and C columns consisting only of zeros and ones. A square killer is a square sub-matrix in memory, consisting of more than one character, that, when rotated 180 degrees looks exactly the same. For example, the following matrix contains 3 square killers:
101010
111001
101001
memory
....10
....01
......
killer 1
......
...00.
...00.
killer 2
101...
111...
101...
killer3Mirko is wondering if there is a connection between the size of the largest square killer and the bug in the program. Help Mirko by writing a program that, given the layout of the memory, outputs the size of the largest square killer. The size of the square killer is the number of rows (or columns) that the killer consists of. In the example above the killer sizes are 2, 2 and 3, respectively.
Output the size of the largest killer on a single line, or output -1 if there are no square killers.
3 6
101010
111001
101001Output:
34 5
10010
01010
10101
01001Output:
33 3
101
111
100Output:
-1Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.