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 listJul 16, 2026 13:25Andrew TsibinAndrew TsibinError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 5, 2026 10:43Haha Expert296.24CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 5, 2026 10:44011,415,6021,106,00002,117,632expected "300", got "51 "
2Sep 5, 2026 10:44012,205,3221,097,00002,117,632expected "300", got "51 "
3Sep 5, 2026 10:44010,765,3251,103,00002,117,632expected "300", got "51 "
4Jul 16, 2026 13:262,98510,704,8931,194,00002,117,632
5Jul 16, 2026 13:263,03210,626,6811,213,00002,117,632
6Jul 16, 2026 13:263,06210,670,4271,225,00002,117,632
7Jul 16, 2026 13:263,20710,574,1991,283,00002,117,632
8Jul 16, 2026 13:263,26710,892,6341,307,00002,117,632
9Jul 16, 2026 13:263,35510,868,3311,342,00002,117,632
10Jul 16, 2026 13:263,36710,794,6551,347,00002,117,632
11Jul 16, 2026 13:263,42012,078,2711,368,00002,117,632
12Jul 16, 2026 13:263,47710,827,8291,391,00002,117,632