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 listAug 18, 2025 04:09Yuriy LyfenkoYuriy LyfenkoError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Oct 5, 2026 20:38Andrew Epstein10.53CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 5, 2026 20:42038,980,69927,327,0001,124,0002,117,632expected "49", got "50 "
2Oct 5, 2026 20:42039,462,78827,888,0001,085,0002,117,632expected "48", got "50 "
3Oct 5, 2026 20:42011,972,87301,687,0002,121,728expected "4352", got "100 "
4Aug 18, 2025 04:0910,61521,549,2062,123,0002,123,0002,281,472
5Aug 18, 2025 04:0911,11519,270,3313,335,0001,111,0002,494,464
6Aug 18, 2025 04:0911,16523,328,0803,350,0001,116,0002,281,472
7Aug 18, 2025 04:1011,25520,388,7833,377,0001,125,0002,486,272
8Aug 18, 2025 04:0911,32021,744,7973,396,0001,132,0002,281,472
9Aug 18, 2025 04:1011,49322,311,0553,448,0001,149,0002,281,472
10Aug 18, 2025 04:0911,55324,432,2213,466,0001,155,0002,281,472
11Aug 18, 2025 04:0911,56522,125,6183,470,0001,156,0002,396,160
12Aug 18, 2025 04:0911,62020,492,4923,486,0001,162,0002,281,472
13Aug 18, 2025 04:1011,64324,424,4613,493,0001,164,0002,400,256
14Aug 18, 2025 04:0911,71520,822,3833,515,0001,171,0002,281,472
15Aug 18, 2025 04:0911,95529,014,4172,391,0002,391,0002,281,472