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 listOct 16, 2026 22:14janwwwjanwwwScore: 3,092Success
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Oct 29, 2026 22:12Andrew Epstein24.19CustomSolution Held
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 16, 2026 22:162,6309,704,0541,052,00002,113,536
2Oct 16, 2026 22:162,8159,722,2741,126,00002,113,536
3Oct 16, 2026 22:162,8309,717,9811,132,00002,113,536
4Oct 16, 2026 22:162,9279,723,0551,171,00002,113,536
5Oct 16, 2026 22:163,09211,418,3431,237,00002,113,536
6Oct 16, 2026 22:163,0959,792,3881,238,00002,113,536
7Oct 16, 2026 22:163,1209,791,3841,248,00002,113,536
8Oct 16, 2026 22:163,2429,909,7111,297,00002,113,536
9Oct 16, 2026 22:163,2479,931,4631,299,00002,113,536