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 11:19C21C21Score: 57,237Success
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 11:2057,05734,569,89721,804,0001,019,0002,113,536
2Oct 25, 2026 11:2057,06233,735,92721,812,0001,013,0002,113,536
3Oct 25, 2026 11:2057,12233,768,41621,836,0001,013,0002,113,536
4Oct 25, 2026 11:2057,12533,888,57321,838,0001,012,0002,113,536
5Oct 25, 2026 11:2057,23733,761,19921,811,0001,084,0002,113,536
6Oct 25, 2026 11:2057,30034,397,19221,830,0001,090,0002,113,536
7Oct 25, 2026 11:2057,37034,441,63721,858,0001,090,0002,113,536
8Oct 25, 2026 11:2057,39733,938,28721,870,0001,089,0002,113,536
9Oct 25, 2026 11:2057,48735,950,24321,862,0001,133,0002,113,536