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 listSep 23, 2026 19:23Matthias GörgensMatthias GörgensScore: 40,400Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 23, 2026 19:2440,03726,350,93114,998,0001,017,0002,113,536
2Sep 23, 2026 19:2440,24226,473,46814,938,0001,159,0002,113,536
3Sep 23, 2026 19:2440,30026,453,58314,933,0001,187,0002,113,536
4Sep 23, 2026 19:2440,32227,766,19814,967,0001,162,0002,113,536
5Sep 23, 2026 19:2440,40026,509,30314,994,0001,166,0002,113,536
6Sep 23, 2026 19:2440,43026,494,39414,980,0001,192,0002,113,536
7Sep 23, 2026 19:2440,47726,686,66215,175,0001,016,0002,113,536
8Sep 23, 2026 19:2440,65727,450,82515,200,0001,063,0002,113,536
9Sep 23, 2026 19:2440,75726,688,52615,225,0001,078,0002,113,536