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 listMay 11, 2026 14:46Victor MerckléVictor MerckléError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 4, 2026 22:30Tomislav Tunkovic10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 4, 2026 22:38012,263,0601,791,0001,644,0002,154,496expected "1003", got "255 "
2Sep 4, 2026 22:38011,942,8742,254,0001,499,0002,154,496expected "1399", got "255 "
3Sep 4, 2026 22:38011,720,6182,225,0001,279,0002,154,496expected "1114", got "255 "
4May 11, 2026 14:483,78010,396,1661,512,00002,215,936
5May 11, 2026 14:484,01211,574,54401,605,0002,215,936
6May 11, 2026 14:484,20210,694,5141,681,00002,170,880
7May 11, 2026 14:484,74211,764,9641,897,00002,170,880
8May 11, 2026 14:484,75010,514,9611,900,00002,215,936
9May 11, 2026 14:484,81511,361,0801,926,00002,170,880
10May 11, 2026 14:484,84011,458,8971,936,00002,215,936
11May 11, 2026 14:485,24210,244,91502,097,0002,170,880
12May 11, 2026 14:485,48010,072,65702,192,0002,215,936