Largest Square Submatrix of all 1's Haha Expert

Find the largest square submatrix consisting entirely of 1s as fast as possible.

Input

A 10,000 x 10,000 matrix of uint8 values (0 or 1) on STDIN.

0, 1, 0, 1, 1
0, 1, 1, 1, 1
0, 0, 1, 0, 0
1, 0, 1, 1, 0

Output

Print the side length of the largest all-ones square submatrix to STDOUT. The answer is guaranteed to be greater than 1.

For the example above, the output is:

2
Back to listNov 25, 2026 21:49e1011e1011Error
Source Code

Source code access is restricted. Log in to request access.

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Nov 25, 2026 21:50048,458,67337,702,0001,065,0002,113,536expected "50", got "70267067 "
2Nov 25, 2026 21:50048,039,22037,543,0001,031,0002,113,536expected "50", got "70261821 "
3Nov 25, 2026 21:50048,297,74037,574,0001,057,0002,113,536expected "95", got "70251912 "