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 17, 2026 22:20zayd-ansari-codezayd-ansari-codeScore: 1,303,042Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 17, 2026 22:211,295,737581,654,543390,937,000127,358,00069,632
2Oct 17, 2026 22:211,295,992544,798,342391,326,000127,071,00036,864
3Oct 17, 2026 22:211,298,240549,712,545391,716,000127,580,00024,576
4Oct 17, 2026 22:211,301,180559,194,117391,691,000128,781,00073,728
5Oct 17, 2026 22:211,303,042549,243,470392,389,000128,828,00077,824
6Oct 17, 2026 22:211,303,827541,700,555392,269,000129,262,00053,248
7Oct 17, 2026 22:211,313,037547,644,188391,253,000133,962,00020,480
8Oct 17, 2026 22:211,313,157554,401,490391,895,000133,368,00020,480
9Oct 17, 2026 22:211,314,430544,644,803392,100,000133,672,00020,480