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 listDec 1, 2026 05:03Dominique GarmierDominique GarmierScore: 27,985Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Dec 1, 2026 05:043,3659,061,6281,346,00002,162,688
2Dec 1, 2026 05:043,6209,144,8251,448,00002,162,688
3Dec 1, 2026 05:043,8629,324,5711,545,00002,162,688
4Dec 1, 2026 05:044,1979,306,4591,679,00002,162,688
5Dec 1, 2026 05:0427,98518,901,86710,090,0001,104,0002,158,592
6Dec 1, 2026 05:0428,00719,081,82110,069,0001,134,0002,158,592
7Dec 1, 2026 05:0428,03518,877,13110,131,0001,083,0002,158,592
8Dec 1, 2026 05:0428,35019,032,83810,235,0001,105,0002,158,592
9Dec 1, 2026 05:0428,40519,008,72710,235,0001,127,0002,158,592