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 listSep 13, 2026 22:18Andrew EpsteinAndrew EpsteinScore: 2,957Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 13, 2026 22:252,91011,026,7061,164,000028,672stderr
2Sep 13, 2026 22:252,94012,097,8411,176,000028,672stderr
3Sep 13, 2026 22:252,94210,894,0341,177,000028,672stderr
4Sep 13, 2026 22:252,95210,884,2431,181,000028,672stderr
5Sep 13, 2026 22:252,95710,909,8141,183,000028,672stderr
6Sep 13, 2026 22:252,96011,026,8021,184,000028,672stderr
7Sep 13, 2026 22:253,02710,966,2241,211,000028,672stderr
8Sep 13, 2026 22:253,06013,080,7631,224,000028,672stderr
9Sep 13, 2026 22:253,32023,020,8891,328,000028,672stderr