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 listJun 6, 2025 23:46zielajzielajError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 4, 2026 16:42Victor Mercklé10.00CustomSolution Broken
Jul 5, 2026 22:35Victor Mercklé10.00CustomSolution Held
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 4, 2026 16:49023,816,85015,395,00002,113,536expected "2", got "50 "
2Sep 4, 2026 16:49023,856,65515,438,00002,113,536expected "2", got "50 "
3Sep 4, 2026 16:49023,980,23114,495,0001,044,0002,113,536expected "2", got "50 "
4Jun 6, 2025 23:472,96515,814,0151,186,00002,490,368
5Jun 6, 2025 23:462,98321,520,76201,193,0002,490,368
6Jun 6, 2025 23:463,02519,532,71801,210,0002,490,368
7Jun 6, 2025 23:483,12018,181,9461,248,00002,527,232
8Jun 6, 2025 23:483,24319,565,5081,297,00002,527,232
9Jun 6, 2025 23:473,24821,668,2081,299,00002,490,368
10Jun 6, 2025 23:483,24813,628,0411,299,00002,486,272
11Jun 6, 2025 23:473,26318,234,0301,305,00002,490,368
12Jun 6, 2025 23:463,34319,746,9151,337,00002,490,368
13Jun 6, 2025 23:4639,72341,964,00214,896,000993,0002,490,368
14Jun 6, 2025 23:4639,75532,555,83714,909,000993,0002,486,272
15Jun 6, 2025 23:4640,15043,391,15815,057,0001,003,0002,498,560