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 listMay 26, 2025 18:39KeefeKeefeScore: 82,205Success
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Oct 5, 2026 20:41Andrew Epstein10.00CustomSolution Held
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1May 26, 2025 18:3981,42057,055,42632,568,00002,387,968
2May 26, 2025 18:3981,70058,721,26431,659,0001,021,0002,265,088
3May 26, 2025 18:3981,78866,670,03731,693,0001,022,0002,383,872
4May 26, 2025 18:3982,11056,713,46530,854,0001,990,0002,387,968
5May 26, 2025 18:3982,20561,558,47531,886,000996,0002,273,280
6May 26, 2025 18:3982,22059,502,41931,892,000996,0002,273,280
7May 26, 2025 18:3982,41366,158,96730,968,0001,997,0002,273,280
8May 26, 2025 18:3982,51359,049,98331,005,0002,000,0002,273,280
9May 26, 2025 18:3982,58558,422,90931,032,0002,002,0002,273,280