Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

CO060716 - 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 zeroes and ones. A square killer is a square 
submatrix 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:

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 zeroes and ones. A square killer is a square submatrix 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:

Mirko 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.

Input

 

The first will contain two integers, R and C, smaller than or equal to 300.

The next R lines will each contain C characters ('0' or '1') with no spaces

Lưu ý: 40% số test có N <= 100

Output

Output the size of the largest killer on a single line, or output -1 if there are no square killers

Example

 

Input:
3 6
101010
111001
101001

Output:
3

 

 

Input:
4 5
10010
01010
10101
01001

Output:
3

 

Input:
3 3
101
111
100

Output:
-1 

Được gửi lên bởi:adm
Ngày:2012-10-30
Thời gian chạy:1s
Giới hạn mã nguồn:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Ngôn ngữ cho phép:ASM32-GCC ASM32 MAWK BC C CSHARP C++ 4.3.2 CPP CPP14 COFFEE LISP sbcl DART FORTH GO JAVA JS-RHINO JS-MONKEY KTLN OCT PAS-GPC PAS-FPC PERL PERL6 PROLOG PYTHON PYTHON3 PY_NBC R RACKET SQLITE SWIFT UNLAMBDA

hide comments
2023-03-31 04:57:15
thở cũng ac
2013-04-13 08:18:53 an IM3 Ex-Member of Bit


Last edit: 2014-01-11 13:23:13
2012-11-03 11:32:34 [cvp]
Có ai biết yahoo hay mail của anh mdptit không ạ? Em là chủ trang http://spoj.pl/CODEVN nhưng chưa là contest setter được lâu thành ra tạo cái lỗi ai sub bài đều sửa contest được định hỏi anh mdptit xem sửa như thế nào
2012-11-03 04:57:41 Vương Sỹ Huấn DH BK TP HCM
Do phuc tap tan n^4 nen chi duoc 40%
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.