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 listSep 13, 2026 17:14Andrew EpsteinAndrew EpsteinScore: 4,885Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 13, 2026 17:224,54510,406,83501,818,0002,162,688stderr
2Sep 13, 2026 17:224,54510,369,5581,818,00002,162,688stderr
3Sep 13, 2026 17:224,73510,350,20201,894,0002,199,552stderr
4Sep 13, 2026 17:224,73710,494,78601,895,0002,162,688stderr
5Sep 13, 2026 17:224,88510,461,71901,954,0002,170,880stderr
6Sep 13, 2026 17:224,91021,628,13501,964,0002,199,552stderr
7Sep 13, 2026 17:224,95710,493,95001,983,0002,199,552stderr
8Sep 13, 2026 17:225,00210,481,94102,001,0002,199,552stderr
9Sep 13, 2026 17:225,07710,598,67102,031,0002,199,552stderr