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 3, 2026 05:57Karthik ReddyKarthik ReddyError
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 3, 2026 05:580490,490,558455,138,00022,781,0002,113,536expected "80", got "A80 h23,22,25,15,15,18,21,25,23,22,25 big1 80@5639,8845 "
2Oct 3, 2026 05:580488,872,269455,520,00022,730,0002,113,536expected "64", got "A64 h22,19,28,21,17,20,16,15,13,15,27 big1 64@3984,5259 "
3Oct 3, 2026 05:580490,160,989456,266,00023,262,0002,113,536expected "95", got "A95 h17,24,23,12,26,23,17,23,17,26,21 big1 95@4330,3011 "