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 19, 2026 13:28Andrew EpsteinAndrew EpsteinScore: 23,710Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 19, 2026 13:5423,40019,978,2044,680,0004,680,00036,864stderr
2Sep 19, 2026 13:5423,42519,409,2114,685,0004,685,00036,864stderr
3Sep 19, 2026 13:5423,44520,011,6484,689,0004,689,00036,864stderr
4Sep 19, 2026 13:5423,52519,315,9374,705,0004,705,00036,864stderr
5Sep 19, 2026 13:5423,71019,450,8384,742,0004,742,00036,864stderr
6Sep 19, 2026 13:5423,97719,586,4534,795,0004,796,00036,864stderr
7Sep 19, 2026 13:5424,01520,881,0844,803,0004,803,00036,864stderr
8Sep 19, 2026 13:5424,03719,648,9594,807,0004,808,00036,864stderr
9Sep 19, 2026 13:5424,07219,657,1014,814,0004,815,00036,864stderr