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 3, 2026 04:10Karthik ReddyKarthik ReddyError
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 3, 2026 04:100668,302,418656,690,0001,007,0002,117,632expected "57", got "A57 90@2212,1508 77@6838,943 65@5245,1405 57@6578,3248 50@5984,7498 50@3895,2690 50@3948,8808 50@4099,4786 50@6386,6626 50@4178,5661 50@5636,9652 50@2669,2245 50@2642,4499 50@2629,4361 50@4335,4404 50@7160,9273 50@4514,4008 50@9278,...
2Oct 3, 2026 04:100668,033,062656,221,0001,233,0002,113,536expected "85", got "A85 85@5415,1524 83@2150,5065 80@8803,7454 76@7914,5354 56@6240,9080 54@810,8082 54@2376,6952 52@6129,8945 50@6259,8515 50@4205,2434 50@6899,5761 50@3829,3714 50@6930,5643 50@6944,2889 50@7078,7938 50@3047,6075 50@2247,3892 50@7612,...
3Oct 3, 2026 04:100667,862,863655,667,0001,003,0002,117,632expected "50", got "A50 65@648,3661 57@5655,2753 53@6002,7927 50@8134,5335 50@9266,3470 50@2098,3358 50@3387,5065 50@3688,2398 50@3846,7018 50@9587,6936 50@4508,7916 50@4518,3822 50@1267,9277 50@5218,6554 50@1153,3450 50@813,8135 50@8765,386 50@7057,62...