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 22, 2026 12:35M-RochatM-RochatError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 5, 2026 09:06Haha Expert10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 5, 2026 09:060634,582,708607,955,00016,516,0002,113,536expected "706", got "666 "
2Sep 5, 2026 09:060424,304,164395,821,00018,333,0002,117,632expected "710", got "638 "
3Sep 5, 2026 09:060517,139,447488,842,00018,150,0002,113,536expected "688", got "613 "
4May 22, 2026 12:3611,17514,799,6983,336,0001,134,0002,121,728
5May 22, 2026 12:3611,22514,744,4463,417,0001,073,0002,121,728
6May 22, 2026 12:3611,24214,256,2343,439,0001,058,0002,121,728
7May 22, 2026 12:3611,27014,679,5853,449,0001,059,0002,121,728
8May 22, 2026 12:3611,28716,155,3403,463,0001,052,0002,121,728
9May 22, 2026 12:3611,31715,943,6743,466,0001,061,0002,121,728
10May 22, 2026 12:3611,39514,673,7983,474,0001,084,0002,121,728
11May 22, 2026 12:3611,45716,184,1163,518,0001,065,0002,121,728
12May 22, 2026 12:3611,52514,436,5283,530,0001,080,0002,121,728