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 listApr 24, 2026 11:10limanjun99limanjun99Error
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 5, 2026 09:07Haha Expert10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 5, 2026 09:07019,108,5607,166,0001,087,0002,121,728expected "691", got "571"
2Sep 5, 2026 09:07018,057,5976,850,0001,181,0002,121,728expected "671", got "611"
3Sep 5, 2026 09:07018,060,6906,867,0001,176,0002,121,728expected "680", got "618"
4Apr 24, 2026 11:1221,36222,996,3707,477,0001,068,0002,523,136
5Apr 24, 2026 11:1221,40530,309,9967,492,0001,070,0002,523,136
6Apr 24, 2026 11:1221,46723,851,8377,514,0001,073,0002,531,328
7Apr 24, 2026 11:1221,51528,707,7377,531,0001,075,0002,527,232
8Apr 24, 2026 11:1221,56030,896,3667,546,0001,078,0002,519,040
9Apr 24, 2026 11:1221,57024,369,4867,550,0001,078,0002,338,816
10Apr 24, 2026 11:1221,57528,517,5347,552,0001,078,0002,523,136
11Apr 24, 2026 11:1221,71226,550,3467,600,0001,085,0002,535,424
12Apr 24, 2026 11:1221,85525,923,8487,650,0001,092,0002,527,232