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 25, 2025 10:48rogue *rogue *Error
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 7, 2026 07:32Haha Expert10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 7, 2026 07:360128,866,107117,948,0001,088,0002,113,536expected "300", got "255 "
2Sep 7, 2026 07:360128,910,821117,881,0001,095,0002,113,536expected "300", got "255 "
3Sep 7, 2026 07:360128,835,218117,961,0001,015,0002,113,536expected "300", got "255 "
4May 25, 2025 10:48900,193387,102,084358,077,0002,000,0002,367,488
5May 25, 2025 10:48900,443381,164,552360,177,00002,371,584
6May 25, 2025 10:48901,378388,912,589360,551,00002,486,272
7May 25, 2025 10:48901,600390,123,144360,640,00002,371,584
8May 25, 2025 10:48901,695389,040,442358,680,0001,998,0002,457,600
9May 25, 2025 10:48901,760384,134,316359,705,000999,0002,375,680
10May 25, 2025 10:48901,833386,303,506358,735,0001,998,0002,519,040
11May 25, 2025 10:48901,920389,623,490358,770,0001,998,0002,519,040
12May 25, 2025 10:48902,163391,290,404357,867,0002,998,0002,510,848