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:12C21C21Score: 79,152Success
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:1378,99542,553,79830,589,0001,009,0002,113,536
2Oct 24, 2026 09:1379,02242,654,81330,599,0001,010,0002,113,536
3Oct 24, 2026 09:1379,07742,603,97630,610,0001,021,0002,113,536
4Oct 24, 2026 09:1379,13542,566,20130,631,0001,023,0002,113,536
5Oct 24, 2026 09:1379,15242,617,05830,470,0001,191,0002,113,536
6Oct 24, 2026 09:1379,17543,939,73630,656,0001,014,0002,113,536
7Oct 24, 2026 09:1379,20542,559,80530,668,0001,014,0002,113,536
8Oct 24, 2026 09:1379,21542,632,19430,658,0001,028,0002,113,536
9Oct 24, 2026 09:1379,28042,665,33130,614,0001,098,0002,113,536