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 24, 2026 09:30C21C21Score: 48,860Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 24, 2026 09:3248,65730,395,22418,278,0001,185,0002,113,536
2Oct 24, 2026 09:3248,66730,381,16318,453,0001,014,0002,113,536
3Oct 24, 2026 09:3248,70530,359,40818,457,0001,025,0002,113,536
4Oct 24, 2026 09:3248,76731,723,82918,474,0001,033,0002,113,536
5Oct 24, 2026 09:3248,86030,478,91818,463,0001,081,0002,113,536
6Oct 24, 2026 09:3248,87231,007,03518,467,0001,082,0002,113,536
7Oct 24, 2026 09:3248,94230,934,51218,498,0001,079,0002,113,536
8Oct 24, 2026 09:3248,95030,487,09318,482,0001,098,0002,113,536
9Oct 24, 2026 09:3249,42530,689,97818,738,0001,032,0002,113,536