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 25, 2026 10:10C21C21Score: 55,550Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 25, 2026 10:1355,32033,119,65021,114,0001,014,0002,113,536
2Oct 25, 2026 10:1355,33733,211,57121,103,0001,032,0002,113,536
3Oct 25, 2026 10:1355,54033,138,75421,139,0001,077,0002,113,536
4Oct 25, 2026 10:1355,54733,650,22521,143,0001,076,0002,113,536
5Oct 25, 2026 10:1355,55033,674,40721,131,0001,089,0002,113,536
6Oct 25, 2026 10:1355,57033,155,61321,134,0001,094,0002,113,536
7Oct 25, 2026 10:1355,62533,169,23821,168,0001,082,0002,113,536
8Oct 25, 2026 10:1355,63233,804,88321,156,0001,097,0002,113,536
9Oct 25, 2026 10:1355,83733,235,99921,127,0001,208,0002,113,536